-->
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.  [ 6 posts ] 
Author Message
 Post subject: Multiple Schemas
PostPosted: Thu Sep 08, 2005 10:19 am 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
Hibernate version:
3.0
Mapping documents:
Na
Code between sessionFactory.openSession() and session.close():
Na
Full stack trace of any exception that occurs:
Na
Name and version of the database you are using:
Oracle 10 g
The generated SQL (show_sql=true):
Na
Debug level Hibernate log excerpt:
Na

Can hibernate function across multiple schemas using a single SessionFactory? If so how? I think I have to create two SessionFactory objects in order to this ... not sure though.

Thanks for any suggestions/help


Top
 Profile  
 
 Post subject: Re: Multiple Schemas
PostPosted: Thu Sep 08, 2005 10:34 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
noone wrote:
Can hibernate function across multiple schemas using a single SessionFactory? If so how? I think I have to create two SessionFactory objects in order to this ... not sure though.

Thanks for any suggestions/help


As long as the schemas are in the same database, Hibernate has no issue.

you can specify the schema in each mapping file. See section 6.1.2 in the 3.0.5 Documentation.

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

This can also be specified at the <class> level and all collection levels.
Do a search on schema= in the docs.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 10:36 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
I think you have to create two session factories.

This would also be more ideal because each session factory requires its own configuration file and initialization of a session factory is very expensive so you would want to do it once at applicaiton startup instead of switching one around (if switching one around is even possible, which I don't think it is).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 10:38 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
boy was I wrong.

never thought to look if the mapping files could do it


Top
 Profile  
 
 Post subject: Multiple Schemas
PostPosted: Tue Sep 13, 2005 4:07 am 
Newbie

Joined: Tue Sep 13, 2005 3:57 am
Posts: 5
One can specify the schema in the hibernate-mapping element for a class but how do you specify the schema specific password and username? I can only see one place where database username and password can be set and that's in the hibernate.cfg.xml file.

So it seems that hibernate allows you to access different schemas in the same database provided those schemas have the same security access?? Is this correct?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 4:14 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 12:31 pm
Posts: 25
I think so. we need to have diiferent configuration files to do so.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.