This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. « Back to Custom Deployments
JPA on Tomcat
(Redirected from JPA)
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
- Hibernate JPA has these bugs
TODO
- Make it work with OpenJPA and Hibernate JPA
- Test with other transaction managers
- Test with other App Servers
- Dynamic Query API
- Implement query cache using provider specific hints
- 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.
- Remove any hibernate dependence
- com.liferay.counter.service.persistence.IDGenerator (if unused, remove)
- com.liferay.portal.dao.shard.ShardSessionFactoryTargetSource
- Fix HIBERNATE_JDBC_BATCH_SIZE in BatchSessionImpl
43940 Views