-->
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: question about DiscriminatorColumn
PostPosted: Sun Oct 05, 2008 7:40 am 
Newbie

Joined: Wed Nov 29, 2006 12:27 am
Posts: 7
I do single mapping for my database,
and specify the annotation as blow
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)

my question is : can we get the value when we doing codeing?
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
class A {
....
}

@DiscriminatorValue("B")
class B extend A{
..
}

in the database, i can see there is a column "type", and holding value there,

but how can i get the its value,

is it that there are anyway i can get the value like this b.getType()???

thanks .


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 10, 2008 4:57 pm 
Beginner
Beginner

Joined: Fri Sep 12, 2008 10:55 am
Posts: 33
When you set the DiscriminatorValue for it - that is the value for type.

A good idea would be to create an @Transient type and set it in your constructor to "B"


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.