Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331956

Summary: Runtime exception thrown for the generators with different types
Product: z_Archived Reporter: Nan Li <nan.n.li>
Component: EclipselinkAssignee: Guy Pelletier <guy.pelletier>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox, guy.pelletier, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Nan Li CLA 2010-12-06 16:31:00 EST
Build Identifier: 20100917-0705

The following exception is thrown when trying to deploy generators with different names and types defined in the mapping XML:

Exception in thread "main" Local Exception Stack: 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@1ef6a746
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [DaliRuntimeProj] failed.
Internal Exception: java.lang.NullPointerException
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:133)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at dali.runtim.Runtime.main(Runtime.java:14)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [DaliRuntimeProj] failed.
Internal Exception: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1005)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:124)
	... 4 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [DaliRuntimeProj] failed.
Internal Exception: java.lang.NullPointerException
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
	... 7 more
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.addSequenceGenerator(MetadataProject.java:573)
	at org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.process(XMLEntityMappings.java:526)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processEntityMappings(MetadataProcessor.java:463)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:437)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:959)
	... 6 more

Reproducible: Always

Steps to Reproduce:
1. Define a sequence generator and a table generator with different names at the mapping file level in the mapping XML
2. Try to run the application

Note: The same exception is thrown with the following cases:
- table generator at the mapping file level in the mapping XML + sequence generator at the mapping level in the Java entity
- table generator at the entity level in the mapping XML + sequence generator at the entity level in the Java entity
Comment 1 Tom Ware CLA 2010-12-17 09:06:04 EST
We should triage this issue for the next patch.
Comment 2 Guy Pelletier CLA 2011-10-04 08:12:37 EDT
This has been fixed in 2.3.1, please upgrade your version. Otherwise a workaround would be to add pk-column-value="" to your table generator specification.

*** This bug has been marked as a duplicate of bug 351791 ***
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:03:29 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink