-->
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.  [ 3 posts ] 
Author Message
 Post subject: Discriminator value
PostPosted: Tue Feb 10, 2004 8:39 am 
Beginner
Beginner

Joined: Tue Feb 10, 2004 8:22 am
Posts: 28
Hi,

I have three classes that extends from an abstract class 'Resource', and I'm using a string field 'indTypeResource' like discriminator to identify witch o these classes should be instantiated.

The instantiation is working very well, but I can't access the attribute 'indTypeResource', that should be avaible from the resource class as I'm using like discriminator.

Is that possible? How can I do that?

My resourse.hbm:
....
<discriminator
column="IND_TYPE_RESOURCE"
type="string"
/>
...

_________________
Ricardo K. Costa


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 8:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can map it as a property in addition, and set insert=false update=false on the property mapping.

Do you really need that however, I mean you can just check with instanceof what class you have ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 9:01 am 
Beginner
Beginner

Joined: Tue Feb 10, 2004 8:22 am
Posts: 28
It worked... :-)

I was using instanceof, but the source wasn't very clean and this way has a better meaning.

Thank you!

_________________
Ricardo K. Costa


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.