hello!
i have a big problem. i want to share the hibernate session factory from the e-learning platform OLAT [1] to use it in another web application. the hibernate session is used through a singleton in the whole OLAT application. it uses the one-session-per-request pattern. the second webapp is displayed inside an iframe inside OLAT. the session will be closed at the end of each request.
the problem is, when i'm using the session factory from jndi in the other webapp it works without problem. after closing the iframe (which is a request inside OLAT)
OLAT throws an exception saying that the session is already closed. the other webapp uses the session with the help of a HibernateUtil getting the session factory from jndi.
this is a typical method from my other webapp, i do not open or close any session manually (setting: current session context class=thread):
Code:
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
HibernateUtil.getSessionFactory().getCurrentSession().delete(object);
HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
this is the hibernate config from the OLAT webapp:
Code:
<hibernate.dialect>org.hibernate.dialect.MySQLDialect</hibernate.dialect>
<hibernate.connection.driver_class>com.mysql.jdbc.Driver</hibernate.connection.driver_class>
<hibernate.connection.url>jdbc:mysql://localhost:3306/olat?useOldUTF8Behavior=true&useUnicode=true&characterEncoding=UTF-8</hibernate.connection.url>
<hibernate.connection.username>####</hibernate.connection.username>
<hibernate.connection.password>####</hibernate.connection.password>
<hibernate.show_sql>false</hibernate.show_sql>
<hibernate.query.factory_class>org.hibernate.hql.ast.ASTQueryTranslatorFactory</hibernate.query.factory_class>
<hibernate.query.substitutions>true 1, false 0, yes 'Y', no 'N'</hibernate.query.substitutions>
<hibernate.transaction.factory_class>org.hibernate.transaction.JDBCTransactionFactory</hibernate.transaction.factory_class>
<hibernate.jdbc.batch_size>0</hibernate.jdbc.batch_size>
<hibernate.jdbc.use_streams_for_binary>true</hibernate.jdbc.use_streams_for_binary>
<hibernate.use_outer_join>true</hibernate.use_outer_join>
<hibernate.max_fetch_depth>10</hibernate.max_fetch_depth>
<hibernate.cache.use_query_cache>false</hibernate.cache.use_query_cache>
<hibernate.cache.use_second_level_cache>false</hibernate.cache.use_second_level_cache>
<hibernate.cache.provider_class>org.hibernate.cache.NoCacheProvider</hibernate.cache.provider_class>
<hibernate.c3p0.debugUnreturnedConnectionStackTraces>true</hibernate.c3p0.debugUnreturnedConnectionStackTraces>
<hibernate.c3p0.unreturnedConnectionTimeout>60</hibernate.c3p0.unreturnedConnectionTimeout>
<hibernate.connection.provider_class>org.hibernate.connection.C3P0ConnectionProvider</hibernate.connection.provider_class>
<hibernate.c3p0.min_size>20</hibernate.c3p0.min_size>
<hibernate.c3p0.max_size>50</hibernate.c3p0.max_size>
<hibernate.c3p0.timeout>1800</hibernate.c3p0.timeout>
<hibernate.c3p0.max_statements>10000</hibernate.c3p0.max_statements>
<hibernate.c3p0.autoCommitOnClose>false</hibernate.c3p0.autoCommitOnClose>
<hibernate.c3p0.acquire_increment>2</hibernate.c3p0.acquire_increment>
<hibernate.c3p0.idle_test_period>500</hibernate.c3p0.idle_test_period>
<hibernate.connection.isolation>2</hibernate.connection.isolation>
<!-- jndi settings -->
<hibernate.session_factory_name>java:hibernate/OlatSessionFactory</hibernate.session_factory_name>
<hibernate.current_session_context_class>thread</hibernate.current_session_context_class>
how i have to change the settings to get it to work? note: i cannot change the OLAT source code! i only can change the hibernate settings.
[1]:
http://www.olat.orggreetings
iggy