-->
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.  [ 5 posts ] 
Author Message
 Post subject: Objects in schema X with references to objects in schema Y
PostPosted: Wed Oct 19, 2005 10:41 am 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
I have a User schema for single sign on and various other schema for different systems. I want to (without my code changing to deal with it) have the users in X and say an order in Y with the POJO holding a User. I could build this to have the ID for the user and go get it, but I don't want to have to do that. Can a single SessionFactory be setup to access 2 schemas? If not is there another way?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 11:10 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Yes, a single SessionFactory can have object/associations that cross schemas. Of course, you may have to deal with permissions, but as long as the database allows access, Hibernate has no problem with multiple schemas.

_________________
nathan


Top
 Profile  
 
 Post subject: Ok, how?
PostPosted: Wed Oct 19, 2005 11:16 am 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
VERY COOL. How do I tell Hibernate what schema each object is in? My only understanding is that you can setup the connection in the cfg file, and I have always had the schema in the connection string.

You know, if things keep going like this these computer thingys are going to catch on some day.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 11:23 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
It's an attribute of the <class>, <joined-subclass>, ... tags. There is also a hibernate.default_schema property you can set in your hibernate.properties file.

_________________
nathan


Top
 Profile  
 
 Post subject: annotation?
PostPosted: Wed Oct 19, 2005 12:13 pm 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
Can I annotate that? Annotations are where it is at!!!!


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