-->
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: To set values for <any > mapping
PostPosted: Wed Jul 04, 2007 12:28 am 
Newbie

Joined: Wed Jul 04, 2007 12:08 am
Posts: 1
Hi
Can any one help me with this?
I have a mapping in my hbm.xml like the following.
<any name="owner" meta-type="string" id-type="long" cascade="save-update">
<meta-value value="Lov" class="com.mckesson.common.eom.reference.Lov"/>
<meta-value value="Organization" class="com.mckesson.common.eom.organization.Organization"/>
<column name="OWNER_CLASS"/>
<column name="OWNER_GSEQ"/>
</any>

<property name="ownerSeq" type="long" not-null="true" insert="false" update="false">
<column name="OWNER_GSEQ"/>
</property>
<property name="ownerType" type="string" insert="false" update="false">
<column name="OWNER_CLASS"/>
</property>

and in the corresponding POJO, the above mapping has been converted as :
private Object owner;
private Long ownerSeq;
private String ownerType;
public Object getOwner() {
return owner;
}

private void setOwnerSeq(Long ownerSeq) {
this.ownerSeq = ownerSeq;
}

private Long getOwnerSeq() {
return ownerSeq;
}

private void setOwnerType(String ownerType) {
this.ownerType = ownerType;
}

private String getOwnerType() {
return ownerType;
}

and in the corresponding table, the column 'OWNER_GSEQ' is mandatory.

Now I am not able to set values for these two columns with the above specified mapping from my code.

I can post some more details if required.

_________________
Thanks
Siva


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 1:01 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
In case of use of <any> mapping, The first column holds the type of the associated entity. The remaining columns hold the identifier. It is impossible to specify a foreign key constraint for this kind of association, so this is most certainly not meant as the usual way of mapping (polymorphic) associations. You should use this only in very special cases (eg. audit logs, user session data, etc). So This may be one reason.

Thanks,
Gopal
[please rate, if helpful]


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.