-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to map collections using arbitrary join criteria?
PostPosted: Wed Oct 15, 2008 1:21 pm 
Newbie

Joined: Tue May 27, 2008 12:35 pm
Posts: 8
Hibernate version: 3.3

I think this is an easy one guys. I don't know why I can't figure it out. But I have a requirement to create some collections where a primary key is not involved. I'll give two examples...

[Dog]
- id
- name
- breed
- shows (how to relate Dog.breed -> DogShow.breed ?)

[DogShow]
- id
- showType
- breed
- schedules (how to relate DogShow.showType & DogShow.breed to DogShowSchedule.showType & DogShowSchedule.breed?)

[DogShowSchedule]
- id
- date
- showType
- breed

The two different collections are essentially the same type but the 2nd one has two join criteria instead of just one.
I want these for the sole purpose of querying in HQL. I do not want to manage/persist these associations through these mappings (i.e. they'll be read-only).
I'm sure this is covered in the documentation, but I'm just not getting it. I've tried several variations using @JoinColumn, mappedBy, etc.
Could somebody please give me a quick example? I'm using annotations, but I could probably translate and XML example.

thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2008 11:49 pm 
Newbie

Joined: Tue May 27, 2008 12:35 pm
Posts: 8
Not possible in Hibernate? Just use SQL?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 20, 2008 12:07 am 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
Using Theta joins, as shown here

http://hibernar.org/foro/viewtopic.php?f=4&t=10

_________________
Gonzalo Díaz


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