java - PagingAndSortingRepository (Spring MCV) and Hibernate -


i'm trying create pagination system spring interface pagingandsortingrepository. i'm following guides on internet, i'm stuck @ first step.

i implemented pagingandsortingrepository way

public interface artistarepository extends pagingandsortingrepository<artista,integer> {     list<artista> findbynome(string nome);   } 

if try run webapplication error:

no qualifying bean of type [javax.persistence.entitymanagerfactory] defined 

i use hibernate session entity manager. in example saw on internet, jpa entitymanager used.

this code inside configuration.xml file:

<bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager">          <property name="sessionfactory" ref="sessionfactory" />                 </bean>            <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean">         <property name="datasource" ref="datasource"/>                        <property name="packagestoscan" value="com.jeansedizioni.model"/>    </bean>    

since i'm not using jpa entitymanager, how should edit code?

thank in advance

declaring hibernate's session factory won't work. spring-data-jpa repositories work jpa entity manager, fellow m. deinum wrote.

try configuration:

    <bean id="jpavendoradapter" class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter">     <property name="showsql" value="true"/>     <property name="generateddl" value="false"/>     <property name="database" value="<your database - oracle, mysql...>"/> </bean>  <bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean">     <property name="datasource" ref="datasource"/>     <property name="jpavendoradapter" ref="jpavendoradapter"/>     <property name="persistenceunitname" value="default"/>     <!-- spring based scanning entity classes>-->     <property name="packagestoscan" value="com.jeansedizioni.model"/> </bean>   <bean id="transactionmanager" class="org.springframework.orm.jpa.jpatransactionmanager">     <property name="entitymanagerfactory" ref="entitymanagerfactory"/> </bean> 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -