Szia,<br><br>Köszönöm a választ. Azzal is próbálkoztam, de az hibernate3-hoz van. Ebben a pillanatban lett jó, a megoldás pusztán annyi volt, hogy nem szabad összekeverni a sessionfactory-t az entitymanager-el :)<br><br>A módosult konfig:<br>
<br><bean id="entityManagerFactory"<br> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"><br> <property name="dataSource" ref="dataSource" /><br>
<property name="packagesToScan" value="my.spring.model" /><br> <property name="jpaVendorAdapter"><br> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"><br>
<property name="showSql" value="$persistence{hibernate.show_sql}" /><br> </bean><br> </property><br> <property name="jpaProperties"><br>
<props><br> <prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop><br> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop><br>
<prop key="hibernate.cache.use_query_cache">true</prop><br> <prop key="hibernate.cache.use_second_level_cache">true</prop><br> <prop key="hibernate.cache.provider_configuration_file_resource_path">classpath:ehcache.xml</prop><br>
<prop key="hibernate.generate_statistics">true</prop><br> <prop key="hibernate.cache.use_structured_entries">true</prop><br> </props><br>
</property><br> <property name="persistenceUnitName" value="s2aUnit" /><br> </bean><br><br>A sessionFactory bean meg kuka, és így jó :)<br clear="all"><div><br>Köszi mégegyszer,<br>
Bartuszek Viktor</div>
<br><br><div class="gmail_quote">On Thu, Feb 7, 2013 at 9:06 AM, cx.chico <span dir="ltr"><<a href="mailto:cx.chico@gmail.com" target="_blank">cx.chico@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Szia!<br>
<br>
Személyes tapasztalatom nincs a témában, de egy helyen ezt láttam:<br>
<br>
<property name="hibernate.cache.region.factory_class">Net.sf.ehcache.hibernate.EhCacheRegionFactory<<br>
/property><br>
<br>
Ehhez lehet, hogy kell a nem-hibernate-s ehcache is a pom.xml-be.<br>
<br>
Üdv,<br>
Chico<br>
<br>
<br>
2013/2/6 Bartuszek Viktor <<a href="mailto:viktor.bartuszek@rhodeus.hu">viktor.bartuszek@rhodeus.hu</a>>:<br>
<div><div class="h5">> Sziasztok!<br>
><br>
> Meggyűlt a bajom a ${subject} kombóval, és már sajnos a 30+ konfig után már<br>
> nem tudom merre menjek tovább. Erre a felállásra nem találtam sajno howto.<br>
><br>
> Jelen pillanatban a releváns spring konfigok így néznek ki:<br>
><br>
> <jpa:repositories base-package="my.spring.repository"<br>
> entity-manager-factory-ref="entityManagerFactory"<br>
> transaction-manager-ref="transactionManager" /><br>
><br>
> <bean id="transactionManager"<br>
> class="org.springframework.orm.hibernate4.HibernateTransactionManager"><br>
> <property name="dataSource" ref="dataSource" /><br>
> <property name="sessionFactory" ref="sessionFactory" /><br>
> </bean><br>
><br>
> <bean id="sessionFactory"<br>
> class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"><br>
> <property name="dataSource" ref="dataSource"/><br>
> <property name="hibernateProperties"><br>
> <props><br>
> <prop<br>
> key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop><br>
> <prop<br>
> key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop><br>
> <prop key="hibernate.cache.use_query_cache">true</prop><br>
> <prop<br>
> key="hibernate.cache.use_second_level_cache">true</prop><br>
> <prop<br>
> key="hibernate.cache.provider_configuration_file_resource_path">classpath:ehcache.xml</prop><br>
> <prop key="hibernate.generate_statistics">true</prop><br>
> <prop<br>
> key="hibernate.cache.use_structured_entries">true</prop><br>
> </props><br>
> </property><br>
> <property name="packagesToScan" value="my.spring.model" /><br>
> </bean><br>
><br>
> <bean id="entityManagerFactory"<br>
><br>
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"><br>
> <property name="dataSource" ref="dataSource" /><br>
> <property name="packagesToScan" value="my.spring.model" /><br>
> <property name="jpaVendorAdapter"><br>
> <bean<br>
> class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"><br>
> <property name="showSql"<br>
> value="$persistence{hibernate.show_sql}" /><br>
> </bean><br>
> </property><br>
> <property name="persistenceUnitName" value="myUnit" /><br>
> </bean><br>
><br>
> A logban a lényegi bejegyzések:<br>
> 2013-02-06 16:34:11,031 DEBUG [][] n.s.e.config.ConfigurationFactory -<br>
> Configuring ehcache from ehcache.xml found in the classpath:<br>
> file:/home/bartuszekv/.../target/classes/ehcache.xml<br>
> 2013-02-06 16:34:11,031 DEBUG [][] n.s.e.config.ConfigurationFactory -<br>
> Configuring ehcache from URL:<br>
> file:/home/bartuszekv/.../target/classes/ehcache.xml<br>
> 2013-02-06 16:34:11,031 DEBUG [][] n.s.e.config.ConfigurationFactory -<br>
> Configuring ehcache from InputStream<br>
> 2013-02-06 16:34:11,040 DEBUG [][] net.sf.ehcache.config.BeanHandler -<br>
> Ignoring ehcache attribute xmlns:xsi<br>
> 2013-02-06 16:34:11,040 DEBUG [][] net.sf.ehcache.config.BeanHandler -<br>
> Ignoring ehcache attribute xsi:noNamespaceSchemaLocation<br>
> 2013-02-06 16:34:11,040 DEBUG [][] n.s.e.config.DiskStoreConfiguration -<br>
> Disk Store Path: /tmp/EhCacheSpringStore<br>
> 2013-02-06 16:34:11,084 DEBUG [][] net.sf.ehcache.util.PropertyUtil -<br>
> propertiesString is null.<br>
> 2013-02-06 16:34:11,088 DEBUG [][] n.s.e.config.ConfigurationHelper - No<br>
> CacheManagerEventListenerFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,125 DEBUG [][] net.sf.ehcache.Cache - No<br>
> BootstrapCacheLoaderFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,125 DEBUG [][] net.sf.ehcache.Cache - CacheWriter<br>
> factory not configured. Skipping...<br>
> 2013-02-06 16:34:11,126 DEBUG [][] n.s.e.config.ConfigurationHelper - No<br>
> CacheExceptionHandlerFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,128 DEBUG [][] net.sf.ehcache.Cache - No<br>
> BootstrapCacheLoaderFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,129 DEBUG [][] net.sf.ehcache.Cache - CacheWriter<br>
> factory not configured. Skipping...<br>
> 2013-02-06 16:34:11,129 DEBUG [][] n.s.e.config.ConfigurationHelper - No<br>
> CacheExceptionHandlerFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,129 DEBUG [][] net.sf.ehcache.Cache - No<br>
> BootstrapCacheLoaderFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,129 DEBUG [][] net.sf.ehcache.Cache - CacheWriter<br>
> factory not configured. Skipping...<br>
> 2013-02-06 16:34:11,129 DEBUG [][] n.s.e.config.ConfigurationHelper - No<br>
> CacheExceptionHandlerFactory class specified. Skipping...<br>
> 2013-02-06 16:34:11,129 WARN [][] net.sf.ehcache.Cache - Cache:<br>
> org.hibernate.cache.UpdateTimestampsCache has a maxElementsInMemory of 0.<br>
> In Ehcache 2.0 this has been changed to mean a store with no capacity limit.<br>
> Set it to 1 if you want no elements cached in memory<br>
> 2013-02-06 16:34:11,146 DEBUG [][] net.sf.ehcache.Cache - Initialised cache:<br>
> org.hibernate.cache.UpdateTimestampsCache<br>
> 2013-02-06 16:34:11,146 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured. Skipping for<br>
> 'org.hibernate.cache.UpdateTimestampsCache'.<br>
> 2013-02-06 16:34:11,146 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured for defaultCache. Skipping for<br>
> 'org.hibernate.cache.UpdateTimestampsCache'.<br>
> 2013-02-06 16:34:11,153 DEBUG [][] n.s.e.s.c.f.DiskOverflowStorageFactory -<br>
> Deleting data file org.hibernate.cache.StandardQueryCache.data<br>
> 2013-02-06 16:34:11,164 DEBUG [][] net.sf.ehcache.Cache - Initialised cache:<br>
> org.hibernate.cache.StandardQueryCache<br>
> 2013-02-06 16:34:11,164 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured. Skipping for<br>
> 'org.hibernate.cache.StandardQueryCache'.<br>
> 2013-02-06 16:34:11,164 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured for defaultCache. Skipping for<br>
> 'org.hibernate.cache.StandardQueryCache'.<br>
> 2013-02-06 16:34:11,193 INFO [][] org.hibernate.validator.util.Version -<br>
> Hibernate Validator 4.2.0.Final<br>
> 2013-02-06 16:34:11,499 DEBUG [][] net.sf.ehcache.Cache - Initialised cache:<br>
> my.spring.model.Entity1<br>
> 2013-02-06 16:34:11,500 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured for defaultCache. Skipping for<br>
> 'my.spring.model.Entity1'.<br>
> 2013-02-06 16:34:11,514 DEBUG [][] net.sf.ehcache.Cache - Initialised cache:<br>
> my.spring.model.Entity2<br>
> 2013-02-06 16:34:11,515 DEBUG [][] n.s.e.config.ConfigurationHelper -<br>
> CacheDecoratorFactory not configured for defaultCache. Skipping for<br>
> 'my.spring.model.Entity2'.<br>
> ...<br>
><br>
> Majd mikor nekifekszik az entitásoknak:<br>
><br>
> 2013-02-06 16:34:13.151:WARN::Nested in<br>
> org.springframework.beans.factory.BeanCreationException: Error creating bean<br>
> with name<br>
> 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0':<br>
> Initialization of bean failed; nested exception is<br>
> org.springframework.beans.factory.BeanCreationException: Error creating bean<br>
> with name 'entityManagerFactory' defined in class path resource<br>
> [persistence-context.xml]: Invocation of init method failed; nested<br>
> exception is javax.persistence.PersistenceException: [PersistenceUnit:<br>
> myUnit] Unable to build EntityManagerFactory:<br>
> org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level<br>
> cache is used in the application, but property<br>
> hibernate.cache.region.factory_classis not gaven, please either disable<br>
> second level cache or set correct region factory class name to property<br>
> hibernate.cache.region.factory_class (and make sure the second level cache<br>
> provider, hibernate-infinispan, for example, available in the classpath).<br>
> at<br>
> org.hibernate.cache.internal.NoCachingRegionFactory.buildEntityRegion(NoCachingRegionFactory.java:69)<br>
> at<br>
> org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:347)<br>
> at<br>
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1740)<br>
> at<br>
> org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)<br>
> at<br>
> org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)<br>
> at<br>
> org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)<br>
> at<br>
> org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)<br>
><br>
> pom.xml erre vonatkozó bejegyzése:<br>
><br>
> <dependency><br>
> <groupId>org.hibernate</groupId><br>
> <artifactId>hibernate-entitymanager</artifactId><br>
> <version>${hibernate.version}</version><br>
> </dependency><br>
> <dependency><br>
> <groupId>org.hibernate</groupId><br>
> <artifactId>hibernate-validator</artifactId><br>
> <version>${hibernate.validator.version}</version><br>
> </dependency><br>
> <dependency><br>
> <groupId>org.hibernate</groupId><br>
> <artifactId>hibernate-ehcache</artifactId><br>
> <version>${hibernate.version}</version><br>
> </dependency><br>
><br>
> Aholis a hibernate verzió 4.1.1.Final<br>
><br>
> Megbírkózott már esetleg valaki ezzel? Az is nagy segítség lenne, ha valami<br>
> erre vonatkozó dokumentációt tudna linkelni valaki.<br>
><br>
> A válaszokat előre is köszönöm,<br>
> Bartuszek Viktor<br>
><br>
</div></div>> _______________________________________________<br>
> Javalist mailing list<br>
> <a href="mailto:Javalist@lists.javaforum.hu">Javalist@lists.javaforum.hu</a><br>
> <a href="http://lists.javaforum.hu/mailman/listinfo/javalist" target="_blank">http://lists.javaforum.hu/mailman/listinfo/javalist</a><br>
><br>
_______________________________________________<br>
Javalist mailing list<br>
<a href="mailto:Javalist@lists.javaforum.hu">Javalist@lists.javaforum.hu</a><br>
<a href="http://lists.javaforum.hu/mailman/listinfo/javalist" target="_blank">http://lists.javaforum.hu/mailman/listinfo/javalist</a><br>
</blockquote></div><br>