-->
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: Can I map more than one database on the same hibernate.cfg?
PostPosted: Fri Jul 28, 2006 11:00 am 
Newbie

Joined: Wed Jul 05, 2006 10:14 am
Posts: 7
Hi,
can I map more than one database on the same hibernate.cfg file?
If this is possible, how should I proceed?

If it´s not possible, how can I map an entity wich is not stored on the same database defined on the hibernate.cfg file? Is it possible too? What should I do in this case?

Hibernate version: 3.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

_________________
Henrique Lobo Weissmann


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 12:20 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
If same db server but a different schema, you could specify the [schema="xxxx"] attribute in .hbm.xml file. This is not very flexible but it will work.

I don't know what your database provides, but you might be able to unify the databases so that it looks like a single db. On DB2/400, we can create an Alias -- a pointer in one database that points to a table in another database (but must be on same database server).

Beyond these suggestions, you will probably need to create multiple .cfg.xml files, multiple SessionFactory object, etc. This has been discussed several times in this forum.

Good luck,
Curtis ...

_________________
---- Don't forget to rate! ----


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.