-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Why Hibernate tries to set tx isolation level to NONE ?
PostPosted: Tue May 17, 2005 10:18 am 
Newbie

Joined: Tue May 17, 2005 8:39 am
Posts: 14
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 2:59 pm 
Newbie

Joined: Tue May 17, 2005 8:39 am
Posts: 14
<property name="connection.isolation">2</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.