Tutorial assumes EclipseLink 2.4.2.v20130514-5956486 running on WebLogic 12.1.2.1 on OSX 10.9 using postgreSQL 9.3 the postgreSQL
JDBC driver jar does not come with WebLogic http://docs.oracle.com/cd/E15051_01/wls/docs103/jdbc_admin/third_party_drivers.html
modify the class http://docs.oracle.com/cd/E15051_01/wls/docs103/admin_ref/weblogicServer.html#ModifyingClasspaht
Download the latest postgreSQL 9.3 JDBC 4.1 jar from
http://jdbc.postgresql.org/download.htmlpostgresql-9.3-1101.jdbc41.jar
Install postgreSQL 9.3 on the mac
Create a database by running Applications/PostgreSQL 9.3/pgAdmin III
Create a datasource in the WebLogic console
JAVA SE RESOURCE_LOCAL persistence.xml
org.eclipse.persistence.jpa.PersistenceProvider
results
[EL Info]: 2014-03-19 18:03:22.718--ServerSession(1898536649)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.4.2.v20130514-5956486 [EL Config]: connection: 2014-03-19 18:03:22.722--ServerSession(1898536649)--Connection(223623898)--Thread(Thread[main,5,main])--connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "postgres" datasource URL=> "jdbc:postgresql://localhost:5432/obrienlabs"
JAVA EE JTA Container Managed persistence.xml
org.eclipse.persistence.jpa.PersistenceProvider
results
[EL Config]: connection: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Connection(1145000203)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) [EL Config]: connection: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Connection(417451054)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Connected: jdbc:postgresql://127.0.0.1:5432/obrienlabs User: postgres Database: PostgreSQL Version: 9.3.3 Driver: PostgreSQL Native Driver Version: PostgreSQL 9.3 JDBC4.1 (build 1101) [EL Finest]: sequencing: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--sequencing connected, state is Preallocation_Transaction_NoAccessor_State
Hibernate 4.2.12 on WebLogic 12.1.2.0
Hibernate 4.3 will not run as a container managed persistence context on WebLogic 12.1.2.0 because only the JPA 2.0 version of the EntityManager proxy is supported (12.1.3.0 should support JPA 2.1). Therefore using Hibernate 4.2 is recommended for 12c.
persistence.xml
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform"/><property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
Running any JPA provider that supports the 2.0 spec
Notes:
1) For polymorphic inheritance - the workaround annotation @ForceDescriminator is definitely your friend
No comments:
Post a Comment