-->
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.  [ 3 posts ] 
Author Message
 Post subject: Connect to multiple database schemas using hibernate
PostPosted: Mon Jul 30, 2007 12:44 pm 
Newbie

Joined: Mon Jul 30, 2007 12:32 pm
Posts: 1
Hi
I am using Hibernate in my project, currently my application connecting to one database schema, according to my new requirement, for some requests I have to connect to some other database schema. I am using single sessionfactory and pulling it from a JNDI tree and database properties are configured in build.properties.xml.

please anyone help me to accomplish this. Thanks in advance

_________________
prasanna_123


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 10:35 pm 
Newbie

Joined: Mon Jul 30, 2007 10:12 pm
Posts: 13
Location: Orust/Sweden
You can use the schema key.

Code:
<hibernate-mapping package="mypackage">
  <class name="Template" table="Templates" schema="mySchema">
    <id name="id" type="long" column="id">
      <generator class="native"/>
    </id>
    <property name="width" type="long" column="Width" not-null="true" />

</hibernate-mapping>


in another hbm.xml file you specify another schema. This works if the schemas are in the same server. If there are different servers please search for it on this forum


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 31, 2007 12:40 am 
Regular
Regular

Joined: Wed Apr 25, 2007 11:44 pm
Posts: 59
can you further elaborate it using hibernate docs

moreover is there any working example for this also for the schemas on the different servers


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.