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

Bug 324194

Summary: JPA: Auto DB detection not working in SE JPA project - DatabasePlatform does not support NativeSequence
Product: z_Archived Reporter: Michael OBrien <michael.f.obrien>
Component: EclipselinkAssignee: Michael OBrien <michael.f.obrien>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: eclipselink.orm-inbox
Version: unspecifiedFlags: michael.f.obrien: documentation+
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
URL: http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Application.xml_WAR_EJB.jar_Module_order_can_cause_ClassLoader_issues_-_EJB_module_with_.40PersistenceContext_Injection_should_be_first
Whiteboard:
Bug Depends on:    
Bug Blocks: 322585, 324213    

Description Michael OBrien CLA 2010-09-01 09:42:35 EDT
>If you get the following exception when running an SE JPA application with/without DDLGeneration
>You are missing a reference to VendorNameToPlatformMapping.properties in eclipselink.jar or in the core/resource directory for IDE projects.

>Reproduction: - disable target-database property or use combined orm.xml and persistence.xml elements
<!-- property name="eclipselink.target-database" value="Derby"/-->

>Exception
[EL Finest]: 2010-09-01 08:42:10.633--ServerSession(23583040)--Thread(Thread[main,5,main])--property=eclipselink.validation-only; value=False
[EL Info]: 2010-09-01 08:42:10.633--ServerSession(23583040)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.2.0.qualifier
[EL Warning]: 2010-09-01 08:42:10.844--Thread(Thread[main,5,main])--Can not load resource [org/eclipse/persistence/internal/helper/VendorNameToPlatformMapping.properties] that loads mapping from vendor name to database platform. Autodetection of database platform will not work.
[EL Fine]: 2010-09-01 08:42:10.844--Thread(Thread[main,5,main])--Detected Vendor platform: null
[EL Info]: 2010-09-01 08:42:10.844--Thread(Thread[main,5,main])--Not able to detect platform for vendor name [Apache Derby]. Defaulting to [org.eclipse.persistence.platform.database.DatabasePlatform]. The database dialect used may not match with the database you are using. Please explicitly provide a platform using property eclipselink.platform.class.name.
[EL Config]: 2010-09-01 08:42:10.854--ServerSession(23583040)--Connection(21479899)--Thread(Thread[main,5,main])--connecting(DatabaseLogin(
	platform=>DatabasePlatform
	user name=> "APP"
	datasource URL=> "jdbc:derby://127.0.0.1:1527/weblogic;create=true"
))
[EL Config]: 2010-09-01 08:42:10.854--ServerSession(23583040)--Connection(535863)--Thread(Thread[main,5,main])--Connected: jdbc:derby://127.0.0.1:1527/weblogic;create=true
	User: APP
	Database: Apache Derby  Version: 10.5.3.0 - (802917)
	Driver: Apache Derby Network Client JDBC Driver  Version: 10.5.3.0 - (802917)
[EL Severe]: 2010-09-01 08:42:10.874--ServerSession(23583040)--Thread(Thread[main,5,main])--Local Exception Stack: 
Exception [EclipseLink-7144] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: EL_CELL_SEQ: platform DatabasePlatform does not support NativeSequence.
	at org.eclipse.persistence.exceptions.ValidationException.platformDoesNotSupportSequence(ValidationException.java:1959)
	at org.eclipse.persistence.sequencing.NativeSequence.onConnect(NativeSequence.java:143)
	at org.eclipse.persistence.sequencing.Sequence.onConnect(Sequence.java:270)
	at org.eclipse.persistence.internal.sequencing.SequencingManager.onConnectAllSequences(SequencingManager.java:843)
	at org.eclipse.persistence.internal.sequencing.SequencingManager.onConnect(SequencingManager.java:706)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeSequencing(DatabaseSessionImpl.java:148)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:420)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:667)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:615)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:383)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:156)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:213)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:201)
	at org.eclipse.persistence.example.jpa.server.common.DDLGenerationClient.initialize(DDLGenerationClient.java:141)
Comment 1 Michael OBrien CLA 2010-09-01 09:44:17 EDT
>fix: add reference to core/resource or the eclipselink.jar
>referencing the core project itself is not enough

	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.core"/>
	<classpathentry kind="lib" path="/org.eclipse.persistence.core/resource"/>

>logs
[EL Finest]: 2010-09-01 09:32:36.065--Thread(Thread[main,5,main])--DBPlatform: org.eclipse.persistence.platform.database.JavaDBPlatform, RegularExpression: (?i).*derby.
[EL Fine]: 2010-09-01 09:32:36.065--Thread(Thread[main,5,main])--Detected Vendor platform: org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: 2010-09-01 09:32:36.075--ServerSession(15184449)--Connection(23370564)--Thread(Thread[main,5,main])--connecting(DatabaseLogin(
>	platform=>JavaDBPlatform
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:04:51 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink