-->
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: Suggstion needed for mapping of a composite field
PostPosted: Thu Nov 20, 2003 5:38 pm 
Newbie

Joined: Mon Sep 08, 2003 12:32 pm
Posts: 10
Hi,
My table has a field that is a concatenation of several fields.
For example: "HTL34GLOBAL".
It is composed of "HTL" + "34" + "GLOBAL".

I have 2 questions:

1. How do I map this field into the 3 sub-fields.?
2. What's the best way to do a search on any combination of the subfields?


thx
tom nguyen/

_________________
thanh nguyen/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 3:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
<composite-id>
        <key-property name="medicareNumber"/>
        <key-property name="dependent"/>
</composite-id>

See section 4.1.5 of the reference guide

Code:
from bank.Person person
where person.id.country = 'AU'
    and person.id.medicareNumber = 123456


Where country and medicareNumber are properties of the composite-id

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 3:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
And override equals() and hashCode()

_________________
Emmanuel


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.