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.  [ 4 posts ] 
Author Message
 Post subject: Mehrere Datenbanken parallel anzapfen
PostPosted: Thu Jan 04, 2007 8:13 am 
Newbie

Joined: Wed Jan 03, 2007 10:36 am
Posts: 2
Hallo zusammen,
würde gerne mehrere Datenbanken gleichzeitig anzapfen - weiss allerdings nicht genau wie ich das machen könnte und wie das dann mit der sessionfactory abläuft.

Würde mich über nen Tip freuen

Danke

Eike


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 1:12 pm 
Newbie

Joined: Sun Jan 07, 2007 1:02 pm
Posts: 4
Wenn Du über den EntityManager gehst genügen einfach mehrere persistence-units in persistence.xml die Du dann mit Namen ansprechen kannst. Falls Du unbedingt eine Hibernate Session brauchst, die gibt es dann z.B. über EntityManager.getDelegate().

Falls Du das nicht möchtest:

SessionFactory sessionFactory1 = new Configuration()
.configure("/persistence/db1.cfg.xml")
.buildSessionFactory();

SessionFactory sessionFactory2 = new Configuration()
.configure("/persistence/db2.cfg.xml")
.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 5:52 pm 
Newbie

Joined: Wed Jan 03, 2007 10:36 am
Posts: 2
Danke. Funzt einwandfrei.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 6:08 pm 
Newbie

Joined: Sun Jan 07, 2007 1:02 pm
Posts: 4
Wenn es Dir geholfen hat würde ich mich natürlich über ein Rating freuen. Man weiß ja nie wofür man vielleicht mal credits braucht :)

_________________
Please credit if it helped!
Bitte credit nicht vergessen wenns geholfen hat!


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