-->
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: 3 Table Join Situation
PostPosted: Mon Nov 07, 2011 8:01 am 
Newbie

Joined: Mon Nov 07, 2011 7:52 am
Posts: 2
Hello Hibernate folk,

I'm new to Hibernate, and I've got a slightly complicated situation to map to Java objects, from a legacy Oracle database.

server -> service -> location

The foreign key from server to service is a composite (id, ser_code). From service to location is just id.

I need to build from this an object that will give me a server at a given country. Worst case, I could add a new view to the database, doing a join across the tables in SQL, and mapping the view to an object, but being legacy, this isn't the best option.

I thought about using the hibernate keyword "join" to get the same effect as with a view (we're defining our objects in XML by the way), but it seems I can only do that for 1-1 relations? Does anyone know why that is? Here there can be multiple servers at a given service/location, which would rule out this approach.

I also thought I could use the many-to-one style, but that means creating 3 Hibernate objects, which I thought might be less efficient and doesn't look as nice.

Failing that, I understand I could also do something with HQL, but that sounds pretty advanced.

Any advice here about the way to go would be fantastic.

Many thanks!


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.