we have encountered a problem while trying to implement a ladder-game application with a database. We have an entity named 'Spill' that has a ManyToOne relation to another entity named 'Brett'.
But when persistence tries to map the entities to the database it doesn't seem to find them.
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)]) Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
They are both definetely in the persistence.xml file, and the program seems to connect to the database just fine. We have explicitly given the name and schema name:
@Entity @Table(name="spill",schema = "stigespill")
in both classes.
Spill:
@Entity
@Table(name="spill",schema = "stigespill")
public class Spill {
// FELTVARIABLER
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer spillid;
private Integer ferdig;
private Timestamp dato;
@OneToMany(mappedBy = "spill" , cascade = CascadeType.ALL)
private List<Spiller> spillere; // TODO Skiftet fra Queue til ArrayList
@OneToMany(mappedBy = "spill" , cascade = CascadeType.ALL)
private List<Trekk> trekklog;
@ManyToOne( cascade = CascadeType.ALL)
@JoinColumn(name = "brett", referencedColumnName="brettid", insertable = false, updatable = false)
private Brett brett;
}
Brett:
@Entity
@Table(name = "brett", schema = "stigespill")
public class Brett {
// FELTVARIABLER
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer brettid;
@OneToMany(mappedBy = "brett", cascade = CascadeType.ALL)
private List<Rute> ruter;
}
We have been searching the web and tried to figure this out for the last few hours, but we can't find a solution.
Full console log:
[EL Info]: server: 2016-04-26 15:58:15.551--ServerSession(1348949648)--Detected server platform: org.eclipse.persistence.platform.server.NoServerPlatform. [EL Warning]: metadata: 2016-04-26 15:58:15.876--ServerSession(1348949648)--The reference column name [spillid] mapped on the element [field spill] does not correspond to a valid id or basic field/column on the mapping reference. Will use referenced column name as provided. [EL Info]: server: 2016-04-26 15:58:15.951--ServerSession(1348949648)--Detected server platform: org.eclipse.persistence.platform.server.NoServerPlatform. [EL Info]: 2016-04-26 15:58:16.63--ServerSession(1348949648)--EclipseLink, version: Eclipse Persistence Services - 2.6.0.v20150309-bf26070 [EL Severe]: 2016-04-26 15:58:17.084--ServerSession(1348949648)--Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.IntegrityExceptionDescriptor Exceptions:
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Runtime Exceptions:
[EL Info]: connection: 2016-04-26 15:58:17.087--ServerSession(1348949648)--/file:/Users/../Stigespill/bin/_eclipselink logout successful [EL Severe]: ejb: 2016-04-26 15:58:17.091--ServerSession(1348949648)--Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Runtime Exceptions:
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Deployment of PersistenceUnit [eclipselink] failed. Close all factories for this PersistenceUnit. Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Runtime Exceptions:
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:866) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:806) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:305) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:337) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:303) at no.hib.dat101.database.Emh.slettAlt(Emh.java:137) at no.hib.dat101.main.Main_Tekst.main(Main_Tekst.java:12)Caused by: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Deployment of PersistenceUnit [eclipselink] failed. Close all factories for this PersistenceUnit. Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Runtime Exceptions:
at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:239) ... 8 moreCaused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-93] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The table [brett] is not present in this descriptor. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A non-read-only mapping must be defined for the sequence number field. Descriptor: RelationalDescriptor(no.hib.dat101.entities.Spill --> [DatabaseTable(stigespill.spill)])
Runtime Exceptions:
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:701) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:637) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:568) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:804) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:748) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:253) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:728) ... 6 more<code>