Friday, August 13, 2010

Deploying JPA solution to WebLogic

After having successfully tested a JPA module using TopLink Essentials,
I want to deploy it in WebLogic as part of an EAR.

I read that WebLogic recommends using the

org.eclipse.persistence.jpa.PersistenceProvider

persistence provider, rather than the

oracle.toplink.essentials.PersistenceProvider

At this point I remove the toplink-essentials.jar, but the javax.persistence imports are not satisfied any more. So from the Weblogic System Library I add the javax.persistence module.




I also switch from

transaction-type="RESOURCE_LOCAL"

to

transaction-type="JTA"



and make sure you remane all your

property name="toplink.blablabla"

into

property name="javax.persistence.blablabla"


(remember that "property eclipselink.jdbc.user is deprecated")



I get also a

"bla has transactionType RESOURCE_LOCAL and therefore jtaDataSource will be ignored"



This http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#JNDI_Datasource_Setup

will help understand how to configure the JNDI




This is my fantastic persistence.xml - which has made suffer generations of developers:



 
  
  
  org.eclipse.persistence.jpa.PersistenceProvider
  

  
  MQParserDataSource
  
  com.acme.cache.domain.GeographicArea
  com.acme.cache.domain.GeoTimeZone
  com.acme.cache.domain.GeoSiteParent
  com.acme.cache.domain.GeoSiteNameAliaPK
  com.acme.cache.domain.GeoSiteNameAlia
  com.acme.cache.domain.GeoSiteExtension
  com.acme.cache.domain.GeoSiteCodeAliaPK
  com.acme.cache.domain.GeoSiteCodeAlia
  com.acme.cache.domain.GeoSiteAddress
  com.acme.cache.domain.GeoSite
  com.acme.cache.domain.GeoPostalArea
  com.acme.cache.domain.GeoLatestTag
  com.acme.cache.domain.GeoDaylightSavingZone
  com.acme.cache.domain.GeoDaylightSavingDisplaceme
  com.acme.cache.domain.GeoBda
  com.acme.cache.domain.GeoAreaParentagePK
  com.acme.cache.domain.GeoAreaParentage
  com.acme.cache.domain.GeoAreaNameAlia
  com.acme.cache.domain.GeoAreaCodeAlia
  com.acme.cache.domain.BdaConnectorGeoSitePK
  com.acme.cache.domain.BdaConnectorGeoSite
  com.acme.cache.domain.BdaConnectorGeoAreaPK
  com.acme.cache.domain.BdaConnectorGeoArea
  
   
   
   
   
    
    
   
   
   
   

   

  

 








Here http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd you have the XSD, you can notice it's pathetically generic.

No comments: