-->
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: one sessionfactory, accessing multiple schemata
PostPosted: Tue Feb 06, 2007 3:02 pm 
Newbie

Joined: Tue Feb 06, 2007 2:33 pm
Posts: 1
Hello *,


at the moment i am working on a project using hibernate.

We usa a mysql db. Only one database but multiple schemata.
I tried creating one sessionfactory (and one hibernate.cfg.xml) for each schemata and it worked without problems.

I think it would be cleaner and much easier to maintain only one sessionfactory for all schemata/schemas.

The documantation mentions that it is possible and i found several postings saying the same, but i havent found any detailed information how it is done.



Here is what i have done so far:

--) add the schema information to the mapping files

<hibernate-mapping schema="abc">
...
</hibernate-mapping>

<hibernate-mapping schema="xyz">
...
</hibernate-mapping>




I dont know how the connection url of the session factory (at hibernat.dfg.xml) should look like. As far as i know, i have to define a schema here, but wich one should i define here??


<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/abc</property>
</session-factory>
</hibernate-configuration>



any help or hints appreciated

Peter


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.