[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] EclipseLink persisting error (Missing mapping for field)
|
Hello
I have another problem.
When I am persisting an object using eclipselink, I get a Missing
mapping for field error. (see stacktrace below)
Saving the object with Hibernate gives no error.
I have also added a part of my jpa mapping. The strange thing is that it
is working correctly with hibernate.
Is this a bug?
@Entity
@Table(schema="PLI", name = "PLI_CATALOG_PRODUCTS")
@DiscriminatorColumn(name="PRODUCT_TYPE")
public abstract class CatalogProduct{
@Id
@GeneratedValue(generator="seqGen")
@SequenceGenerator(name="seqGen",sequenceName="PLI_SEQ",
allocationSize=1)
private long id;
private String code;
@ManyToOne(cascade=PERSIST)
@JoinColumn(name="family_id", referencedColumnName = "id")
private IndustrialFamily industrialFamily;
......
}
@Table(schema="PLI", name = "PLI_INDUSTRIAL_FAMILIES")
@Entity
public class IndustrialFamily {
@Id
@GeneratedValue(generator="seqGen")
@SequenceGenerator(name="seqGen",sequenceName="PLI_SEQ",
allocationSize=1)
private long id;
.....
}
Tables:
CREATE TABLE PLI_INDUSTRIAL_FAMILIES
(
ID NUMBER(10, 0) NOT NULL,
CODE VARCHAR2(20) NOT NULL,
NAME VARCHAR2(100) NOT NULL
)
;
CREATE TABLE PLI_CATALOG_PRODUCTS
(
ID NUMBER(10, 0) NOT NULL,
CODE VARCHAR2(500) NOT NULL,
FAMILY_ID NUMBER(10, 0) NOT NULL
)
;
javax.persistence.RollbackException: Exception [EclipseLink-45] (Eclipse
Persistence Services - 1.0 (Build SNAPSHOT - 20080409)):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Missing mapping for field
[PLI.PLI_INDUSTRIAL_FAMILIES.id].
Descriptor: RelationalDescriptor(********.model.IndustrialFamily -->
[DatabaseTable(PLI.PLI_INDUSTRIAL_FAMILIES)])
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:109)
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:70)
at ********.test.ImportTest.testSaveImport(ImportTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: Exception [EclipseLink-45] (Eclipse Persistence Services -
1.0 (Build SNAPSHOT - 20080409)):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Missing mapping for field
[PLI.PLI_INDUSTRIAL_FAMILIES.id].
Descriptor: RelationalDescriptor(********.model.IndustrialFamily -->
[DatabaseTable(PLI.PLI_INDUSTRIAL_FAMILIES)])
at
org.eclipse.persistence.exceptions.DescriptorException.missingMappingForField(DescriptorException.java:938)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractValueFromObjectForField(ObjectBuilder.java:1856)
at
org.eclipse.persistence.mappings.OneToOneMapping.writeFromObjectIntoRow(OneToOneMapping.java:1058)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildRow(ObjectBuilder.java:830)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildRow(ObjectBuilder.java:818)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:430)
at
org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:78)
at
org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:88)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:290)
at
org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:653)
at
org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:576)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:114)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2603)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1061)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1045)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:991)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:229)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:185)
at
org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2991)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1240)
at
org.eclipse.persistence.internal.jpa.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:416)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1332)
at
org.eclipse.persistence.internal.jpa.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:145)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1000)
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:91)
... 20 more