How to configure on Tomcat

1. copy lib/development/spring-instrument-tomcat.jar to tomcat/lib/ext
2. Edit conf/Catalina/localhost/ROOT.xml and add this line in the "Context" element.

    <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
3. Delete hibernate3.jar from WEB-INF/lib
4. Copy to WEB-INF/lib
    persistence.jar
    eclipselink.jar
5. configure portal-ext.properties

    1. persistence.provider=jpa
    2. 
transaction.isolation.portal=-1   # Notice that the value is negative 1 which means default
    3. transaction.isolation.counter=-1 

See:


Note:

  • Works only with TopLink and EclipseLink.
  • Although JPA is a spec, not everything works with just any JPA provider. See this blog for details.
    • Hibernate JPA has these bugs
      • https://forum.hibernate.org/viewtopic.php?f=1&t=998837&sid=06373cbf8023349f4f38c342aadc54b1
      • https://forum.hibernate.org/viewtopic.php?f=1&t=999049&p=2416582#p2416582
      • https://forum.hibernate.org/viewtopic.php?f=1&t=998876
    • OpenJPA has this bug
      • http://n2.nabble.com/overriding-accesors-in-entity-need-tranisent-declaration-tp3363414p3363414.html


TODO

  1. Make it work with OpenJPA and Hibernate JPA
  2. Test with other transaction managers
  3. Test with other App Servers
  4. Dynamic Query API
  5. Implement query cache using provider specific hints
  6. Current ScrollableResults is a minimal, non-optimal implementation. Since JPA does not provide one, should implement our own or leverage various mechanisms in a provider specific manner. See toplink-tips and eclipselink-ext.
  7. Remove any hibernate dependence
    1. com.liferay.counter.service.persistence.IDGenerator (if unused, remove)
    2. com.liferay.portal.dao.shard.ShardSessionFactoryTargetSource
    3. Fix HIBERNATE_JDBC_BATCH_SIZE in BatchSessionImpl

 

0 Attachments
10813 Views
Average (0 Votes)
Comments

Showing 2 Comments

Richard Knight
6/30/09 12:34 PM

Will the end result be that Liferay orm mappings will be available through JPA annotations?

Prashant Dighe
8/30/09 5:53 PM

No. The mappings will be available as orm.xml just like hibernate mappings are in hbm.xml