Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @Embeddable Inheritance(How to use DescriptorCustomizer and InheritancePolicy)
@Embeddable Inheritance [message #724410] Mon, 12 September 2011 06:04 Go to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
Hello,

I have an @Embeddable class (let's call it EmbeddableParent). EmbeddableParent is subclassed by another class, also annotated with @Embeddable (let's call this class EmbeddableChild). EmbeddableParent also embeds a third class EmbeddableC. To clear things up, a piece of sample code:

@Embeddable
public class EmbeddableC implements Serializable {
private String stringA;
private String stringB;
...
}


@Embeddable
public class EmbeddableParent implements Serializable {
@Embedded
private EmbeddableC embedded;
...
}


@Embeddable
public class EmbeddableChild extends EmbeddableParent implements Serializable {
...
}


I now used the DescriptorCustomizer and InheritancePolicy to make inheritance for Embeddables work, as suggested by en.wikibooks.org/wiki/Java_Persistence/Embeddables#Inheritance (Apparently I cannot post links, unless I have posted more than 5 messages.).

The code I wrote looks like this:

@Customizer(EmbeddableParent.class)
@Embeddable
public class EmbeddableParent implements Serializable, DescriptorCustomizer {
@Embedded
private EmbeddableC embedded;
...
	@Override
	public void customize(ClassDescriptor descriptor) throws Exception {
		descriptor.getInheritancePolicy().setSingleTableStrategy();
		DatabaseField indicatorField = new DatabaseField();
		indicatorField.setName("QTYPE");
		indicatorField.setLength(20);
		indicatorField.setType(java.lang.String.class);
		descriptor.getInheritancePolicy().setClassIndicatorField(indicatorField);
		descriptor.getInheritancePolicy().useClassNameAsIndicator();
	}		
}


@Embeddable
@Customizer(EmbeddableChild.class)
public class EmbeddableChild extends EmbeddableParent implements Serializable, DescriptorCustomizer {
...
	@Override
	public void customize(ClassDescriptor descriptor) {
		descriptor.getInheritancePolicy().setParentClass(EmbeddableParent.class);
	}
}


Using this code, generation of tables from entities fails with a NullPointerException:

java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.updateTables(InheritancePolicy.java:1847)

1847        Vector<DatabaseTable> parentTables = getParentDescriptor().getTables();

java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.postInitialize(InheritancePolicy.java:1122)

1121            ClassDescriptor parent = getParentDescriptor();
1122            if (parent.hasPreDeleteMappings()) {


It seems, parentDescriptor is not set correctly. What am I doing wrong? Did I miss something? Or is it a bug? Any help is appreciated.

[Updated on: Tue, 13 September 2011 14:55]

Report message to a moderator

Re: @Embeddable Inheritance [message #724594 is a reply to message #724410] Mon, 12 September 2011 12:01 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

> descriptor.getInheritancePolicy().setParentClass(Quantity.class);

Should this be EmbeddableParent not Quantity?


James : Wiki : Book : Blog : Twitter
Re: @Embeddable Inheritance [message #725036 is a reply to message #724594] Tue, 13 September 2011 14:55 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
Yes, it should, and it is correct class is set in my code.

[Updated on: Tue, 13 September 2011 14:56]

Report message to a moderator

(no subject) [message #725047 is a reply to message #724594] Tue, 13 September 2011 14:55 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 14
Registered: March 2011
Junior Member
Yes, it should.
Re: (no subject) [message #725295 is a reply to message #725047] Wed, 14 September 2011 09:08 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
Could it be, that this issue is a problem in Dali and I should post it in the Dali-forum?
Re: (no subject) [message #725756 is a reply to message #725295] Thu, 15 September 2011 13:14 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Can you include the full exception stack trace, and the full correct source code for your classes.


James : Wiki : Book : Blog : Twitter
Re: (no subject) [message #726316 is a reply to message #725756] Sat, 17 September 2011 05:38 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
Thank you for looking into this.

Here is the full output of "Generate Tables from Entities", including the stack trace:

[EL Config]: The access type for the persistent class [class test.embeddable.EntityClass] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EmbeddableChild] is set to [FIELD].
[EL Config]: The alias name for the entity class [class test.embeddable.EntityClass] is being defaulted to: EntityClass.
[EL Config]: The table name for entity [class test.embeddable.EntityClass] is being defaulted to: ENTITYCLASS.
[EL Config]: The column name for element [id] is being defaulted to: ID.
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.3.0.v20110604-r9504
[EL Fine]: Detected Vendor platform: org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: Connection(1309828059)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> ""
	datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(123234458)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
	User: APP
	Database: Apache Derby  Version: 10.8.1.2 - (1095077)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.8.1.2 - (1095077)
[EL Config]: Connection(1027299898)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> ""
	datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(1594820133)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
	User: APP
	Database: Apache Derby  Version: 10.8.1.2 - (1095077)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.8.1.2 - (1095077)
[EL Severe]: Local Exception Stack: 
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:501)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	... 7 more

Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------


java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.updateTables(InheritancePolicy.java:1847)
	at org.eclipse.persistence.descriptors.InheritancePolicy.preInitialize(InheritancePolicy.java:1155)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3616)
	at org.eclipse.persistence.mappings.AggregateObjectMapping.initialize(AggregateObjectMapping.java:1156)
	at org.eclipse.persistence.descriptors.ClassDescriptor.initialize(ClassDescriptor.java:2803)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:512)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.postInitialize(InheritancePolicy.java:1122)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3461)
	at org.eclipse.persistence.mappings.AggregateObjectMapping.postInitialize(AggregateObjectMapping.java:1357)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3430)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)

[EL Severe]: Local Exception Stack: 
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)

Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------


java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.updateTables(InheritancePolicy.java:1847)
	at org.eclipse.persistence.descriptors.InheritancePolicy.preInitialize(InheritancePolicy.java:1155)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3616)
	at org.eclipse.persistence.mappings.AggregateObjectMapping.initialize(AggregateObjectMapping.java:1156)
	at org.eclipse.persistence.descriptors.ClassDescriptor.initialize(ClassDescriptor.java:2803)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:512)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


java.lang.NullPointerException
	at org.eclipse.persistence.descriptors.InheritancePolicy.postInitialize(InheritancePolicy.java:1122)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3461)
	at org.eclipse.persistence.mappings.AggregateObjectMapping.postInitialize(AggregateObjectMapping.java:1357)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3430)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


Actually, at this point I really am trying to get the minimal example running, I posted earlier. I have attached a tarball containing the sources for the minimal example and the persistence.xml (without database configuration).
(no subject) [message #726320 is a reply to message #725756] Sat, 17 September 2011 05:38 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 14
Registered: March 2011
Junior Member
Thank you for looking into this.

Here is the full output of "Generate Tables from Entities", including the stack trace:


[EL Config]: The access type for the persistent class [class test.embeddable.EntityClass] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EmbeddableChild] is set to [FIELD].
[EL Config]: The alias name for the entity class [class test.embeddable.EntityClass] is being defaulted to: EntityClass.
[EL Config]: The table name for entity [class test.embeddable.EntityClass] is being defaulted to: ENTITYCLASS.
[EL Config]: The column name for element [id] is being defaulted to: ID.
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.3.0.v20110604-r9504
[EL Fine]: Detected Vendor platform: org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: Connection(1309828059)--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> ""
datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(123234458)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
User: APP
Database: Apache Derby Version: 10.8.1.2 - (1095077)
Driver: Apache Derby Embedded JDBC Driver Version: 10.8.1.2 - (1095077)
[EL Config]: Connection(1027299898)--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> ""
datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(1594820133)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
User: APP
Database: Apache Derby Version: 10.8.1.2 - (1095077)
Driver: Apache Derby Embedded JDBC Driver Version: 10.8.1.2 - (1095077)
[EL Severe]: Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:501)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
... 7 more

Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------


java.lang.NullPointerException
at org.eclipse.persistence.descriptors.InheritancePolicy.updateTables(InheritancePolicy.java:1847)
at org.eclipse.persistence.descriptors.InheritancePolicy.preInitialize(InheritancePolicy.java:1155)
at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3616)
at org.eclipse.persistence.mappings.AggregateObjectMapping.initialize(AggregateObjectMapping.java:1156)
at org.eclipse.persistence.descriptors.ClassDescriptor.initialize(ClassDescriptor.java:2803)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:512)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


java.lang.NullPointerException
at org.eclipse.persistence.descriptors.InheritancePolicy.postInitialize(InheritancePolicy.java:1122)
at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3461)
at org.eclipse.persistence.mappings.AggregateObjectMapping.postInitialize(AggregateObjectMapping.java:1357)
at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3430)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)

[EL Severe]: Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

java.lang.NullPointerException

at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)

Descriptor Exceptions:
---------------------------------------------------------

Runtime Exceptions:
---------------------------------------------------------


java.lang.NullPointerException
at org.eclipse.persistence.descriptors.InheritancePolicy.updateTables(InheritancePolicy.java:1847)
at org.eclipse.persistence.descriptors.InheritancePolicy.preInitialize(InheritancePolicy.java:1155)
at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3616)
at org.eclipse.persistence.mappings.AggregateObjectMapping.initialize(AggregateObjectMapping.java:1156)
at org.eclipse.persistence.descriptors.ClassDescriptor.initialize(ClassDescriptor.java:2803)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:512)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


java.lang.NullPointerException
at org.eclipse.persistence.descriptors.InheritancePolicy.postInitialize(InheritancePolicy.java:1122)
at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3461)
at org.eclipse.persistence.mappings.AggregateObjectMapping.postInitialize(AggregateObjectMapping.java:1357)
at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3430)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:618)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:472)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)


Actually, at this point I really am trying to get the minimal example running, I posted earlier. I have attached a tarball containing the sources for the minimal example and the persistence.xml (without database configuration).
begin 644 EmbeddableInheritance.tar.bz2
M0EIH.3%!629362]N<KT`!D7_F=RQ(`!08__?[Z?_X/__W_H$```0"```&%`$
M_G"UJTL:`%`!HIDTTFF@T:(]1B>D-/4/03U,F(8AB9/2:&F@.830&@-&C"-!
MB-,3)B:#"-`R`9,!)""IX4S5/TIZ-0/4T-,)HR&@!HT,0-``.830&@-&C"-!
MB-,3)B:#"-`R`9,!$I-`@(GIBF$T](R:390:9-,FF@:&@#-)D^Y?8OH#UY-1
MP)PGQWUELDD0F0!6O%Q<G%C9B"YUP5"J)B`:@B0""=@=].8["!91X&XXI$1[
M9#4F"H05`A,,BC1I/S60UPEH$L4LR3(8A&.;M.'5F^=X:AC^/J8,-R.S#KF4
M!,W^D;-*3^S,E#=YDH@->FQ%I"ESVWM?(TW6.W#JGER;\;S(IJ3TH:_;F.9)
M0Y!J)/+"-5I>/#<QM.IP5"_7+5)#/O63!J%BV`6AMK9=EPR\GN6]>W>0EK2!
M+QS.P"<@#B>D`40C*B5`)?886L$K:49!T$0[1P:CL$3O+Y%@O-Y_#H.?]+EQ
MQ77!;%Z:61="VT\4P=##`#-W`V.W'#1K+$I6#)-$PATITVK-:EL\L3#'7GI7
M=3.9*0<;L*@VUM"AC:!8N@MHMY)VK)*Q\Q9*8*:1)*D/7":"ODC[ASZ=D6T=
M=S=1"9@CC800B;V=;43F'NGC>@!!P71.%MA=)-E`!N>"`$;=R+F95/@QZV]_
M,XM%[&X<!$NF<9(<UK\\N@#CG+?R9;5-4.Z[K)$001'1F[-.3OCRY<!D-6F'
M9B,#$%95NBF&?+ZI;DUN[*`)1@/RGY+99JE29:E958;Z`^]!&MSV)I<O8'J@
M;U,[E4#).M?E#;[0Z_[._28I^/YKPG15?D7,W"/WO:&Y\MY1:+[5:KP;R]#K
M%"(AV`>0#%;NRQ=0+[+UZ<E`O#4&X/*'*N,D5`*U+0W:YX&5&03AYS=CK`@8
M2"3DSZ0Q,BZ=^[%V)LGF"CK]YNL2YA(AOK*)(N-UM:A9!M"#8$),RY#(<8H3
M\EWT.5N#:D#`N5-7N.OD72:.T&_`UE%SAD[C8J=TU#!A56Y>#8$2BZB&<"<8
M:@H<6E<?M6VPM#S#;U&R9C:!I6!R%NC]D/>;!J>D6>CF;PR<_HU;QI(Z5O`-
M:U5-18%J0>X)>&;<Z%V!:=N-U@;2!"`0<W#(1A`G>!#CG<(!Q!>N)EP\ZYBY
ML/H8A($1+&A8)X5S`%#P,>UC<WQ0@0Z;Y`H:UMO*LNHVW!@50O+C4[2N&"S,
ME#HWN<\04>$2]*&-#6M02P2T.0)93&`GQ!ZBS%+'>9FN$F#03282YCO$-*^/
M70`L*A#(NU86DA"1($4TT)%W+5:@;]H<`!<'`,YY<1!@MI@'7!P-A2!)`?3"
MFA?XQ`.[F7ETNP:F5!^'PXS#X^/$1RJZ,RZ%2"9VJUS+;%TV,`D&62HE[6H1
M=18A14MY_^#<'*/33>XL7!,1*+4D!@PX0NZDN.,-"=5X',9&PU?%<YU`:`,1
MB^G0&O=CE799P8+XKO75Q+)S;-(;:!]DWA+@.@/@>`Z53_Q=R13A0D"]N<KT
`
end
Re: (no subject) [message #726865 is a reply to message #726316] Mon, 19 September 2011 14:28 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I believe that the issue is that the since the EmbeddableParent is never referenced by any Entity it is not processed, so their is no descriptor for it.

Does it work if you reference the parent instead of the child, or both?

You may be able to define a RelationalDescriptor for the parent in a SessionCustomizer.

This may have been resolved, so you may wish to try the latest build. Otherwise log a bug and vote for it. The ideal fix would be to just support inheritance with embeddables in EclipseLink's JPA annotation processing.


James : Wiki : Book : Blog : Twitter
Re: (no subject) [message #727207 is a reply to message #726865] Tue, 20 September 2011 11:46 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
When referencing the EmbeddableParent class instead of EmbeddableChild, it works as expected. Referencing both classes does not work.

I will try a newer build as well as a SessionCustomizer.

Thanks, Hannes
Re: (no subject) [message #727212 is a reply to message #726865] Tue, 20 September 2011 11:46 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 14
Registered: March 2011
Junior Member
When referencing the EmbeddableParent class instead of EmbeddableChild, it works as expected. Referencing both classes does not work.

I will try a newer build as well as a SessionCustomizer.

Thanks, Hannes
Re: (no subject) [message #727280 is a reply to message #727207] Tue, 20 September 2011 15:21 Go to previous messageGo to next message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
I also tried [EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.4.0.v20110824-r9956, with no luck.
Re: (no subject) [message #731257 is a reply to message #727280] Fri, 30 September 2011 08:05 Go to previous message
Hannes  is currently offline Hannes
Messages: 11
Registered: September 2011
Junior Member
Using a SessionCustomizer, i set the parent and child descriptors, respectively. The NullpointerException is gone, but the generated table is empty:

[EL Fine]: Connection(1237941458)--CREATE TABLE ENTITYCLASS (ID BIGINT NOT NULL, PRIMARY KEY (ID))


The code for the SessionCustomizer is as follows:

...
	@Override
	public void customize(Session session) throws Exception {
		ClassDescriptor parent = session
				.getClassDescriptor(EmbeddableParent.class);
		ClassDescriptor child = session
				.getClassDescriptor(EmbeddableChild.class);
		child.getInheritancePolicy().setParentDescriptor(parent);
		parent.getInheritancePolicy().addChildDescriptor(child);
	}
...


I suppose, the empty table has something to do with EmbeddableParent no being referenced, so I added another entity, which embeds an EmbeddableParent object:

@Entity
public class OtherEntity {

	@Id
	@GeneratedValue
	private long id;
	
	@Embedded
	EmbeddableParent z;
}


Now, when generating tables, the following NullpointerException occurs:


[EL Config]: The access type for the persistent class [class test.embeddable.OtherEntity] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EntityClass] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EmbeddableParent] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EmbeddableA] is set to [FIELD].
[EL Config]: The access type for the persistent class [class test.embeddable.EmbeddableChild] is set to [FIELD].
[EL Config]: The alias name for the entity class [class test.embeddable.OtherEntity] is being defaulted to: OtherEntity.
[EL Config]: The table name for entity [class test.embeddable.OtherEntity] is being defaulted to: OTHERENTITY.
[EL Config]: The column name for element [id] is being defaulted to: ID.
[EL Config]: The column name for element [b] is being defaulted to: B.
[EL Config]: The column name for element [a] is being defaulted to: A.
[EL Config]: The column name for element [c] is being defaulted to: C.
[EL Config]: The alias name for the entity class [class test.embeddable.EntityClass] is being defaulted to: EntityClass.
[EL Config]: The table name for entity [class test.embeddable.EntityClass] is being defaulted to: ENTITYCLASS.
[EL Config]: The column name for element [id] is being defaulted to: ID.
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.3.0.v20110604-r9504
[EL Fine]: Detected Vendor platform: org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: Connection(1846341136)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> ""
	datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(1292981053)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
	User: APP
	Database: Apache Derby  Version: 10.8.1.2 - (1095077)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.8.1.2 - (1095077)
[EL Config]: Connection(745533778)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> ""
	datasource URL=> "jdbc:derby:/Users/hannesweisbach/TestDB;create=true"
))
[EL Config]: Connection(1359545169)--Connected: jdbc:derby:/Users/hannesweisbach/TestDB
	User: APP
	Database: Apache Derby  Version: 10.8.1.2 - (1095077)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.8.1.2 - (1095077)
[EL Info]: file:/Users/hannesweisbach/Documents/uni/master/salespoint/implementation/kp-salespoint/Embeddable_test/bin/_Embeddable_test_url=jdbc:derby:/Users/hannesweisbach/TestDB;create=true login successful
[EL Severe]: java.lang.NullPointerException
	at org.eclipse.persistence.internal.helper.DatabaseField.getTableName(DatabaseField.java:312)
	at org.eclipse.persistence.tools.schemaframework.DefaultTableGenerator.initTableSchema(DefaultTableGenerator.java:303)
	at org.eclipse.persistence.tools.schemaframework.DefaultTableGenerator.generateDefaultTableCreator(DefaultTableGenerator.java:175)
	at org.eclipse.persistence.tools.schemaframework.SchemaManager.getDefaultTableCreator(SchemaManager.java:902)
	at org.eclipse.persistence.tools.schemaframework.SchemaManager.replaceDefaultTables(SchemaManager.java:953)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.createOrReplaceDefaultTables(EntityManagerFactoryProvider.java:90)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.writeDDLToDatabase(EntityManagerFactoryProvider.java:365)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.generateDDL(EntityManagerSetupImpl.java:2787)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:477)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)

Exception in thread "main" javax.persistence.PersistenceException: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:501)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:86)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:77)
	at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:64)
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.helper.DatabaseField.getTableName(DatabaseField.java:312)
	at org.eclipse.persistence.tools.schemaframework.DefaultTableGenerator.initTableSchema(DefaultTableGenerator.java:303)
	at org.eclipse.persistence.tools.schemaframework.DefaultTableGenerator.generateDefaultTableCreator(DefaultTableGenerator.java:175)
	at org.eclipse.persistence.tools.schemaframework.SchemaManager.getDefaultTableCreator(SchemaManager.java:902)
	at org.eclipse.persistence.tools.schemaframework.SchemaManager.replaceDefaultTables(SchemaManager.java:953)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.createOrReplaceDefaultTables(EntityManagerFactoryProvider.java:90)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.writeDDLToDatabase(EntityManagerFactoryProvider.java:365)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.generateDDL(EntityManagerSetupImpl.java:2787)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:477)
	... 7 more


Debugging showed, that the NullpointerException occurs, when the table for OtherEntity is created. For a field in EmbeddableParent, namely "String c", a DatabasField object is generated which does not have a table set.
Previous Topic:eclipselink generates table on the wrong schema
Next Topic:Generated SQL update statement is missing columns
Goto Forum:
  


Current Time: Thu Jul 31 13:44:14 EDT 2014

Powered by FUDForum. Page generated in 0.02390 seconds