I been struggling with struts2-fullhibernatecore-plugin-2.2.2-GA for my CRUD demo project for learning purpose. Below is the error I get and than different hibernate dependencies tried to make it work. See below
ERROR
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory.createAndTestSessionFactory(HibernateSessionFactory.java:284)
com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:227)
com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory.getNewSession(HibernateSessionFactory.java:155)
I understand from this thread answer Click Here
Than I started different maven dependeces to check hibernate version working with plugin and found
NOT WORKING FROM BELOW VERSION
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.6.Final</version>
</dependency>
WORKING TILL THIS VERSION
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.10.Final</version>
</dependency>
Question: Obviously don't want to use Hibernate3 so is there a way I can use latest hibernate4+ with struts2-fullhibernatecore-plugin-2.2.2-GA?
Question: What is the most widely used DI for hibernate in struts2. Should I go for Spring or google juice if above plugin not working?. Don't see any other viable solution for managing hibernate session except that viewpattern but say its antipattern and has many drawbacks.
use this config
and add
<hibernate.maven.plugin.version>3.6.10.Final</hibernate.maven.plugin.version>
to your pom properties.