-->
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.  [ 2 posts ] 
Author Message
 Post subject: many to one clause where
PostPosted: Thu Mar 25, 2004 7:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
we can configure a to-many association with a clause where
<map
name="propertyName"
table="table_name"
schema="schema_name"
lazy="true|false"
inverse="true|false"
cascade="all|none|save-update|delete|all-delete-orphan"
sort="unsorted|natural|comparatorClass"
order-by="column_name asc|desc"
[b]where="arbitrary sql where condition" [b]
outer-join="true|false|auto"
batch-size="N"
access="field|property|ClassName"
>

is it stupid to think about the same idea but for a to-one relation?

Class A
Long idA

Class B (has composite id on idA & date)
Long idA
Date date


so we have Class A one-to-many Class B
but i only need the Object with last date saved
so my need is
Class A
Long idA
ClassB classB

Class B (has composite id on idA & date)
Long idA
Date date


but it seems i must do
Class A
Long idA
List classesB // with where declared in mapping file so i'll always have only one object in my list

Class B (has composite id on idA & date)
Long idA
Date date



Thanks for advices

Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 25, 2004 6:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It's somehow a broken FK relationship. So, adding an unmapped property restricting to your needs should be the best way I guess

_________________
Emmanuel


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