-->
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: how to map an array of objects in a <map>
PostPosted: Tue Sep 08, 2009 11:38 am 
Regular
Regular

Joined: Fri May 22, 2009 4:50 am
Posts: 59
hi,

I need to do mapping for the following class:

public class Policy{
private Map<String, Config> executors = new HashMap<String, Config>();
}
where Config is..

public class Config{
private Money[] priceList;
private Condition openingCondition;
private Condition closingCondition;
}
where Money and Condition are again user defined classes.

I have done the following mapping for my Policy but I don't know how to map the priceList bit of it. Any idea?

Code:
<class name="Policy" table="POLICY">
      <id name="accountId" column="ACCOUNT_ID">
         <generator class="assigned"/>
      </id>
      <map name="executors" table="EXECUTORS" cascade="all">
         <key column="ACCOUNT_ID"/>
         <index column="ID" type="string"/>
         <composite-element class="Config">
            <property name="amount" column="AMOUNT" type="MoneyUserTypes"/>            
            <property name="id" column="EXECUTOR_ID"/>
            <many-to-one name="openingCondition"
               column="OPENING_CONDITION_ID"
               class="Condition"
               unique="true"
               cascade="all"/>
            <many-to-one name="closingCondition"
               column="CLOSING_CONDITION_ID"
               class="Condition"
               unique="true"
               cascade="all"/>            
         </composite-element>
      </map>
   </class>   
   
   <class name="Condition" table="CONDITIONS">
      ------
   </class>
   
   <class name="Account" table="Accounts">
      ------
   </class>


Any suggestions are welcome.

Cheers!


Top
 Profile  
 
 Post subject: Re: how to map an array of objects in a <map>
PostPosted: Wed Sep 09, 2009 4:41 am 
Regular
Regular

Joined: Fri May 22, 2009 4:50 am
Posts: 59
hmm..
I was wondering if <any> tag can be any useful?

Any inputs are welcomed..thanks.


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.