Joined: Mon Sep 03, 2007 7:40 am Posts: 1 Location: India
|
Ok I Have 2 tables Account and Contact
with the following mappings
<class name="Account" table="account" mutable="false">
<id name="id" type="string" length="11" column="id">
<generator class="increment"></generator>
</id>
<property name="name" type="string" length="120" column="name" />
<set name="contact" table="contact_info" inverse="true">
<key column="id"></key>
<one-to-many class="Contact" />
</set>
</class>
<class name="Contact" table="contact_info" mutable="false">
<id column="contact_info_id" name="id" />
<many-to-one name="id" column="contact_info_id" class="Account" insert="false" update="false"/>
<property name="type" type="string" length="11" column="info_type" />
<property name="info" type="string" length="120" column="contact_info_dtls" />
</class>
Now i have a property in my Account class called defaultEmail whose value is in Contact....i have a field type which may have values 'MAIL','PHONE' as the case may be depending upon which value I have to extract and place it in Account.defaultEmail..
Now i need a mapping which would autopopulate the value of defaultEmail when i call the getHibernateTemplate().find("from Account acc "); from Java DAO
|
|