ppfuse-jpa.2.1.0-M2.source-code.applicationContext-dao.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" default-lazy-init="true"> <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/> <!-- EntityManagerFactory --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitManager" ref="persistenceUnitManager"/> <property name="jpaProperties"> <value> hibernate.dialect=${hibernate.dialect} hibernate.query.substitutions=true 'Y', false 'N' hibernate.cache.use_second_level_cache=true hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider </value> <!-- Turn batching off for better error messages under PostgreSQL --> <!-- hibernate.jdbc.batch_size=0 --> </property> </bean> <bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"> <property name="persistenceXmlLocations"> <list> <value>classpath:META-INF/persistence.xml</value> </list> </property> <property name="defaultDataSource" ref="dataSource"/> </bean> <!-- Needed so the @PersistenceUnit annotation is recognized --> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> <!-- Transaction manager for a single EntityManagerFactory (alternative to JTA) --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <!-- Activates scanning of @Autowired --> <context:annotation-config/> <!-- Activates scanning of @Repository --> <context:component-scan base-package="org.appfuse.dao"/> <!-- Compass Search Section --> <!-- Compass Bean, automatically scanning for searchable classes within the model --> <!-- Hooks into Spring transaction management and stores the index on the file system --> <bean id="compass" class="org.compass.spring.LocalCompassBean"> <property name="mappingScan" value="org.appfuse.model" /> <property name="transactionManager" ref="transactionManager" /> <property name="settings"> <map> <entry key="compass.engine.connection" value="target/test-index" /> </map> </property> </bean> <!-- Compass Template allowing to automatically join/start exising transactions when performing operations --> <bean id="compassTemplate" class="org.compass.core.CompassTemplate"> <property name="compass" ref="compass" /> </bean> <!-- Compass Search Helper allowing to perform search operations in a simpler manner --> <bean id="compassSearchHelper" class="org.compass.core.support.search.CompassSearchHelper"> <constructor-arg ref="compass" /> <property name="pageSize" value="10" /> </bean> <!-- CompassGps will automatically mirror any changes done thorugh JPA to searchable classes to the index --> <!-- It will also provide the index operation allowing to reindex the database --> <bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps" init-method="start" destroy-method="stop"> <property name="compass" ref="compass" /> <property name="gpsDevices"> <list> <bean class="org.compass.gps.device.jpa.JpaGpsDevice"> <property name="name" value="jpa" /> <property name="injectEntityLifecycleListener" value="true" /> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> </list> </property> </bean> </beans>