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.  [ 1 post ] 
Author Message
 Post subject: HIbernate Schema Validation issue
PostPosted: Wed Oct 03, 2007 4:15 pm 
Newbie

Joined: Wed Mar 28, 2007 7:53 pm
Posts: 10
Hello everyone.

I have noticed a behavior with the hibernate Schema validation that I'm not sure how to handle. (more on that later)

I use Hibernate to connect to a database from a JBoss server.

I have a hibernate.cfg.xml which contains the following config info (amongst other stuff) :


<!-- This is an example of an Oracle -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:oci:@ORA9DB_XYZ</property>
<property name="connection.username">LAB_A</property>
<property name="connection.password">LAB_A</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>


<!-- Qualify unqualified tablenames with the given schema/tablespace in generated SQL -->
<property name="default_schema">LAB_A</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</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.NoCacheProvider</property>
<!-- <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> -->

<!-- -->
<property name="query.substitutions">yes 'Y', no 'N'</property>
<property name="hbm2ddl.auto">validate</property>
<property name="max_fetch_depth">1</property>
<property name="jdbc.batch_versioned_data">true</property>
<property name="jdbc.use_streams_for_binary">true</property>
<property name="cache.region_prefix">hibernate.test</property>
<property name="proxool.pool.alias">pool1</property>

<mapping resource="com/a/b/models/Person_ora.hbm.xml"/>
etc...



As you can see from above, I have listed my default schema as LAB_A.
I also have a Person_ora.hbm.xml:


<class name="com.a.b.models.Person" table="PERSONS">
<id name="id" column="P_ID">
<generator class="assigned"/> </id>
<property name="p_name" type="string" column="P_NAME"/>
<property name="p_lname" type="string" column="P_LNAME"/>
etc...


My problem is:


When I start my application, and attempt to retrieve data, I expect Hibernate to locate my LAB_A schema in order to validate the PERSONS table. Instead, it seems to use the first schema it finds which contains a PERSONS table and uses that schema instead of the one I specified in the cfg file.

Is there a way I can force a particular schema to be used? Is there a config setting that I can add to the cfg file to do this.


I would appreciate any help at all! :)

Cheers,
Lucise


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

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.