-->
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 not works normally on DB2
PostPosted: Fri May 15, 2009 2:06 am 
Newbie

Joined: Fri May 15, 2009 1:16 am
Posts: 2
Location: Beijing
Hi
I have an application based on DB2. My application has a table named 'roles', set hibernate hbm2ddl.auto=update. When first deploy my application, hiberante finds a built-in table 'roles' already in syscat schema, so it will not create my 'roles' any more.

Below is my hibernate.hbm.xml:
Code:
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.datasource">java:comp/env/jdbc/MyDatabase</property>
        <!-- JDBC connection pool (use the built-in) -->
        <property name="c3p0.min_size">5</property>
        <property name="c3p0.max_size">25</property>
        <property name="c3p0.timeout">1800</property>
        <property name="c3p0.max_statements">100</property>
        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>
        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.OSCacheProvider</property>
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">false</property>
        <!-- Drop and re-create the database schema on startup -->
        <property name="hbm2ddl.auto">update</property>
        <mapping resource="mapping.hbm.xml"/>
        <mapping resource="version_mapping.hbm.xml"/>
    </session-factory>
</hibernate-configuration>


My datasource definition:
Code:
    <Resource name="jdbc/MyDatabase" auth="Container" type="javax.sql.DataSource"
                maxActive="100" maxIdle="50" maxWait="10000"
                username="db2admin" password="db2admin"
                driverClassName="com.ibm.db2.jcc.DB2Driver"
                url="jdbc:db2://192.168.56.101:50000/UDDI:traceLevel=3;driverType=4;currentSchema=MYSCHEMA;"/>


I already assign currentSchema with MYSCHEMA. Seems hibernate doesn't find 'roles' in my schema but in syscat.
This happened in hibernate 3.2.6. Hibernate 3.2.5 works fine.

I saw hibernate 3.2.6 changelog:
* [HHH-2070] - Expand DB2Dialect auto-discovery support (Martin Renner)

Is it because of this patch?

Any help will be appreciated.

_________________
Open your thoughts


Top
 Profile  
 
 Post subject: Re: hbm2ddl.auto=update not works normally on DB2
PostPosted: Tue May 19, 2009 5:41 am 
Newbie

Joined: Fri May 15, 2009 1:16 am
Posts: 2
Location: Beijing
I did find add a <property name="default_schema">MYSCHEMA</property> in hibernate.cfg.xml, it works fine.
But in my case, I can't add such an entry in this hibernate.cfg.xml file

_________________
Open your thoughts


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.