-->
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: hbm2ddl.auto=update - Closing the connection provider?
PostPosted: Tue Jun 27, 2006 10:18 pm 
Newbie

Joined: Tue Jun 27, 2006 9:34 pm
Posts: 3
Hello all,

I am new to hibernate and am trying to figure out why I am encountering issues with the hbm2ddl.auto configuration. I am using the c3p0 connection pooling in conjunction with hibernate. I create a data source using c3p0 and use that as the connection data source for hibernate

With [i]hbm2ddl.auto=create [/i] (create all tables from scratch) the session factory was created successfully with no error.

However, with [i]hbm2ddl.auto=update [/i], I notice that the schema are updated and then I start getting errors in the c3p0 configuration. Any access to the database from that point starts failing because of the connection provider is closed.

When I debugged this in the hibernate code, I noticed that in line 175 of the org.hibernate.tool.hbm2ddl.SchemaUpdate class (execute method), the connection provider is closed after the update is performed. This causes the subsequent open connection operation to the database access to fail.

The connection provider should be closed only when the execute is called fwhile SchemaUpdate is run as a seperate tool. However, when this is called inside the SessionFactoryImpl (line 295), closing the connection provider causes the above issue.

Thanks for the help.
Saravanan




[b]Hibernate version: 3.1.2[/b]

[b]Mapping documents:[/b]
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:hsql://localhost:9001/attuneDb</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>

<!-- Session Factory Name -->
<property name="session_factory_name">attune:hibernate/HibernateFactory</property>

<!-- connection pool via c3p0. The data source is created in the SessionFactoryRegistry-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.min_size">10</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.max_statements">0</property> <!-- caching disabled if 0 -->
<property name="c3p0.timeout">200</property> <!-- seconds -->

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Update Schema on startup -->
<property name="hbm2ddl.auto">update</property>

<mapping resource="com/attune/server/objectModel/fileManager/FileSwitch.hbm.xml"/>
</session-factory>


[b]Full stack trace of any exception that occurs:[/b] Regular db open connection failure

[b]Name and version of the database you are using: [/b] Default Hypersonic database

[b]The generated SQL (show_sql=true):[/b] N/A

[b]Debug level Hibernate log excerpt:[/b] N/A


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 01, 2006 12:49 pm 
Newbie

Joined: Tue Jun 27, 2006 9:34 pm
Posts: 3
Hi all,

I am using Hibernate 3.1.2. I downloaded the source code for 3.1.3, and it looks like this problem is addressed in 3.1.3 release.

Thanks
Saravanan


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.