Hi,
JBoss 4.0.5
Hibernate 3.0
Spring 2.5
Oracle 10g
Cache : EhCache
In Spring Bean, we are creating SessionFactory as below
Code:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="configLocation">
<value>classpath:/hibernate.cfg.xml</value>
</property>
</bean>
In Session Factory Config, I have changed Transaction from JBoss CMT to JDBC as below
Code:
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<!-- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
-->
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.release_mode">auto</property>
<!-- 2nd level caching -->
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<property name="hibernate.cache.use_query_cache">true</property>
</session-factory>
1) I need to commit as Unit of Work
2) Using the same DataSource JBoss AS has.
3) Have to use Cache
Now i got the below error.
Code:
org.hibernate.HibernateException: createCriteria is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy69.createCriteria(Unknown Source)
Need to change in Configuration?