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.  [ 1 post ] 
Author Message
 Post subject: Asking for a technical solution.
PostPosted: Tue Jan 25, 2005 11:25 pm 
Newbie

Joined: Wed Jul 21, 2004 9:41 pm
Posts: 11
Hibernate version:2.1.4

Hi there,
Here is a technical question, in the database I have this table.

CREATE TABLE commitment_item (
CommitmentId id REFERENCES commitment ON DELETE CASCADE,
Ord ord,
ObjId id NULL,
ObjType type CHECK (ObjType in ('CO', 'Item')) NULL,

PRIMARY KEY (CommitmentId, Ord)
);

And because the object can mapped to "CO" or "Item" in hibernate according to the "ObjType" column using "ObjId".
It is OK to use <descriminator-value> to make the CoCommitment object and ItemCommitment object extends from Commitment.
But what I want is: Only a Commitment object in hibernate, but you can use some methods like setXXX(), then when update, hibernate will automatically update the "ObjId" "ObjType" according to the received value.
When receiving a CO, the objType will be 'CO', when receiving an Item, the objType wil be 'Item'...
Is there any way to accomplish this in Hibernate? Thank you very much in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.