Hi
Why Hibernate tries to set tx isolation level to NONE ?
MySQL doesn't support it and connection allocation fails.
How to prevent it ? I have added hibernate.connection.isolation in config
file but it doesn't seem to help.
Is that because my class is immutable (read only) ?
Hibernate version: 2.1.8
Mapping documents:
<!DOCTYPE hibernate-configuration
PUBLIC '-//Hibernate/Hibernate Configuration DTD//EN'
'http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd'>
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/MySQL</property>
<property name="show_sql">true</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!--
TRANSACTION_NONE 0
TRANSACTION_READ_COMMITTED 2
TRANSACTION_READ_UNCOMMITTED 1
TRANSACTION_REPEATABLE_READ 4
TRANSACTION_SERIALIZABLE 8
-->
<property name="hibernate.connection.isolation">2</property>
<!-- Mapping files -->
<mapping resource="lv/idega/txgateway/domain/mappings/Currency.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():
Code:
Configuration con = new Configuration().configure();
SessionFactory sf = con.buildSessionFactory();
Session session = sf.openSession();
Query query = session.createQuery ("select count(*) from lv.idega.txgateway.domain.Currency");
res = ((Integer) query.list().get(0)).intValue();
Full stack trace of any exception that occurs:
[#|2005-05-17T17:09:49.884+0300|SEVERE|sun-appserver-pe8.1_01|javax.enterprise.resource.resourceadapter|_ThreadID=15;|jdbc.exc_tx_level|#]
[#|2005-05-17T17:09:49.884+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.resource.resourceadapter|_ThreadID=15;|RAR5117 : Failed to obtain/create connection. Reason : The isolation level could not be set: Transaction isolation level NONE not supported by MySQL|#]
[#|2005-05-17T17:09:49.884+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.resource.resourceadapter|_ThreadID=15;|RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: The isolation level could not be set: Transaction isolation level NONE not supported by MySQL]|#]
[#|2005-05-17T17:09:49.900+0300|WARNING|sun-appserver-pe8.1_01|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=15;|Could not obtain connection metadata
java.sql.SQLException: Error in allocating a connection. Cause: The isolation level could not be set: Transaction isolation level NONE not supported by MySQL
at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:74)
Name and version of the database you are using:
MySQL 4.1