-->
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: [Mapping]How to have an attribute referecing another DB ?
PostPosted: Tue May 15, 2007 4:19 am 
Newbie

Joined: Thu Apr 19, 2007 11:10 am
Posts: 2
Hi,

hi have a DB which contains a USER table, allowing to determine which Hibernate session (linked to anoter DB) to use for the connected user.

The problem is that some tables of these anoter DB are referencing the obejct USER.

Is that possible to configure the mapping files so that the "user" attirbute references another DB ?

My mapping :
Code:
<hibernate-mapping package="com.abw.valueobject">
   <class name="com.abw.valueobject.AppelVO" table="SCHEMACRM.APPEL" dynamic-update="true" lazy="true">
      <id name="id" column="ID_APPEL">
         <generator class="increment" />
      </id>
      ...

      <many-to-one name="user" column="ID_USER" lazy="proxy" fetch="select" />
   </class>
</hibernate-mapping>


here the attribut "user" has to be linked to another DB.

Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 8:13 am 
Newbie

Joined: Fri Mar 09, 2007 10:12 am
Posts: 6
Hi,

I could be wrong but I think it is not possible this way. You will probably have to create two SessionFactory in order to connect to both databases and then work with different sessions. I don't think it is possible to "fusion" sessions.

Here is an example: you get a session from the first SessionFactory. With this session, you get your user objects. Then, you use the second SessionFactory, get a session and do something in the second database in relation with the user objects you got from the first database.

Regards


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.