-->
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 set null discriminator-value?
PostPosted: Fri Dec 03, 2004 8:32 pm 
Regular
Regular

Joined: Thu Dec 02, 2004 10:42 am
Posts: 54
I have a discriminator column which is allowing null. The column's type is Number.

How can I set the null value for discriminator-value attribute?

Is it possible to set "other" value? that means any other value that not specified are give to this subclass.

----------------------------
Another question:
The actually question is how to dynamicly set up discriminator-value?

We have a code table, which is used for all the codes:
ID Code Desc CodeTypeID
1 AccType AccountType
2 UserType User's Type
3 CreditAcc Credit Account 1
4 LoanAcc Loan Account 1
5 Guest Guest User 2
6 Admin Administrator 2
----------------------------------------
I want to set up object like this:

Abstract Class Code
Class CodeType: Code
AccTypeCode: Code
UserTypeCode: Code
-----------------------
The problem is I don't want to use discriminator-value with 1/2....

Cause the ID value can change, I want to have sth like: discriminator-value="Type.Code='UserType' && Type.CodeTypeID is null"

Is there any easy solution without manipulating the persister in Hibernate or NHibernate?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 04, 2004 6:35 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
AFAIK in Hibernate 3 you will be able to specify an SQL query for the discriminator.

If your DB suports instead of triggers (I only now of Oracle verison >=8) you can create a view an do the appropriate insert/update/delete in the trigger.

HTH
Ernst


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.