@MappedSuperClass with InheritanceType.JOINED nullPointerException [message #1669040] |
Thu, 12 March 2015 18:58 |
Tercio F. Gaudencio Filho Messages: 4 Registered: March 2015 |
Junior Member |
|
|
My scenario:
@Entity
@MappedSuperclass
public abstract class Base {
protected int id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, updatable = false)
public int getId() {
return this.id;
}
public void setId(final int id) {
this.id = id;
}
}
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class SubClass1 extends Base {
private String someField;
// Getters/Setters ...
}
@Entity
public class SubClass2 extends SubClass1 {
private String someOtherField;
// Getters/Setters ...
}
In this case, when I start my application I get this exception:
org.eclipse.persistence.exceptions.IntegrityException:
Descriptor Exceptions:
---------------------------------------------------------
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:701) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:637) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:568) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:804) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:748) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:253) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:724) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getMetamodel(EntityManagerFactoryDelegate.java:646) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:549) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at my.domain.server.dyn.binder.impl.DynBinderImpl.initialize(DynBinderImpl.java:63) [classes/:?]
at my.domain.server.controller.impl.ServerControllerImpl.initialize(ServerControllerImpl.java:43) [classes/:?]
at my.domain.server.tester.DbTester.main(DbTester.java:51) [classes/:?]
2015-03-12T15:40:32,472 ERROR [ org.eclipse.persistence.logging.ejb ] : 134 -
org.eclipse.persistence.exceptions.IntegrityException:
Descriptor Exceptions:
---------------------------------------------------------
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:701) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:637) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:568) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:804) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:748) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:253) ~[eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:724) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getMetamodel(EntityManagerFactoryDelegate.java:646) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:549) [eclipselink-2.6.0-RC1.jar:2.6.0.v20150210-f44015d]
at my.domain.server.dyn.binder.impl.DynBinderImpl.initialize(DynBinderImpl.java:63) [classes/:?]
at my.domain.server.controller.impl.ServerControllerImpl.initialize(ServerControllerImpl.java:43) [classes/:?]
at my.domain.server.tester.DbTester.main(DbTester.java:51) [classes/:?]
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.6.0.v20150210-f44015d): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [myPU] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150210-f44015d): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:859)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:799)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getMetamodel(EntityManagerFactoryDelegate.java:646)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:549)
at my.domain.server.dyn.binder.impl.DynBinderImpl.initialize(DynBinderImpl.java:63)
at my.domain.server.controller.impl.ServerControllerImpl.initialize(ServerControllerImpl.java:43)
at my.domain.server.tester.DbTester.main(DbTester.java:51)
Caused by: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.6.0.v20150210-f44015d): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [myPU] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150210-f44015d): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:239)
... 8 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.6.0.v20150210-f44015d): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
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:724)
... 6 more
The nullPointer is in the method ClassDescriptor#toggleAdditionalTablePrimaryKeyFields(), line 4326:
...
while(itTable.hasNext()) {
Map.Entry<DatabaseTable, Map<DatabaseField, DatabaseField>> entryTable = itTable.next();
DatabaseTable sourceTable = entryTable.getKey();
boolean isSourceProcessed = getTables().indexOf(sourceTable) < nProcessedTables;
int sourceInsertOrderIndex = getMultipleTableInsertOrder().indexOf(sourceTable);
Map<DatabaseField, DatabaseField> targetTableAdditionalPKFields = entryTable.getValue();
//
// NullPointer happens here, entryTable is: "DatabaseTable(SubClass2)=null"
//
Iterator<Map.Entry<DatabaseField, DatabaseField>> itField = targetTableAdditionalPKFields.entrySet().iterator();
...
What I'm doing wrong?
Regards,
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03795 seconds