We sucessfully implementedSpring , hibernate +jpa in our application with Xa transcation.but we trying to implement criteria in our application we are facing one error that ,
java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()
So could you tell which implementation classes are using in hybernate for javax.persistence.criteria.CriteriaBuilder interface
listed few jar file we are using ,
hibernate 3.3 , jpa 2.0
spring-orm 3.0.2
hibernate-entitymanager
Update:
I changed my hibernate jar into( hibernate-core-3.6.0.CR2,hibernate-entitymanager-3.6.0.CR2 versions ) but still same exception is coming ,
CriteriaBuilder criteriaBuilder= this.getJpaTemplate().getEntityManagerFactory().getCriteriaBuilder();
In my config file:
<beans:bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
<beans:property name="entityManagerFactory">
<beans:ref bean="entityManagerFactory" />
</beans:property>
</beans:bean>
<beans:bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<!-- added by shiju for getting atomoikas xa datasource-->
<beans: property name="dataSource">
<beans: ref bean="dataSource"/>
</beans: property>
<beans: property name="persistenceUnitName" value="payhub" />
<beans: property name="jpaVendorAdapter">
<beans:bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<beans: property name="generateDdl" value="false" />
<beans: property name="showSql" value="true" />
<beans: property name="databasePlatform" value="${database.target}" />
</beans:bean>
</beans: property>
<beans: property name="persistenceXmlLocation">
<beans:value>classpath:META-INF/persistence.xml</beans:value>
</beans:property>
</beans:bean>
java.lang.NoSuchMethodError: javax.persistence.EntityManagerFactory.getCriteriaBuilder()Ljavax/persistence/criteria/CriteriaBuilder;…
Could you give any other solution?
I’m pretty sure Hibernate 3.3 doesn’t implement JPA 2. You’ll need to upgrade to something more recent (e.g. 3.6)