-->
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: Include map key in child class
PostPosted: Thu Dec 06, 2007 11:15 am 
Newbie

Joined: Thu Dec 06, 2007 10:41 am
Posts: 3
Hi,

I have what appears to be a simple question, but all my searching was without any success, so I hope that you can help me out:
In my HBM I define a map containing a composite element and I would like to add the key value of the map as a read-only property (with only a getter, no constructor parameter and no setter) to the child class, but I can't figure out how this can be achieved.

The simplified code below refers to my use-case with products including multi-language descriptions.

Code:
<class name="Product" table="product">
   ...
   <map name="descriptions" table="productdescription" fetch="join">
      <key column="productid" />
      <map-key column="language" type="string" />
      <composite-element class="ProductDescription">
         <property name="short" type="string" />
         <property name="long" type="string" />
      </composite-element>
   </map>
</class>


Thanks in advance for your help.[/code]


Top
 Profile  
 
 Post subject: Re: Include map key in child class
PostPosted: Thu Dec 06, 2007 12:18 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
I am not sure if this solves your problem but what if you add the map-key column as a property in the composite-element but set it to ready only by update="false" insert="false". It might solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 06, 2007 8:39 pm 
Newbie

Joined: Thu Dec 06, 2007 10:41 am
Posts: 3
Thanks for your hint! Unfortunately this was one of the approaches I already tried with no effect at all (the field had both getter and setter methods and was included in the constructor signature). I also used the scope meta attribute to make the setter ;-) privat but this (of course) has no effect on the constructor signature.

I also did some further research and I'm starting to believe this is not at all such a straight-forward thing as I expected at the beginning :-( so I still hope for further suggestions. Thanks!


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.