-->
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: Mapping a boolean field to Y/N using annotations
PostPosted: Wed Nov 01, 2006 8:05 am 
Newbie

Joined: Wed Nov 01, 2006 8:00 am
Posts: 2
I've searched for ages but cannot figure out how to map a simple boolean field to a legacy table that requires Y/N values for booleans.

For example:

Code:
@Basic
@Column(name = "PLT_ASSURED")
private boolean assured;


will use 0 and 1 for false and true. I need true=Y and false=N.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 01, 2006 10:54 am 
Beginner
Beginner

Joined: Tue Sep 02, 2003 9:28 pm
Posts: 25
try adding this annotation:


@org.hibernate.annotations.Type(type = "org.hibernate.type.YesNoType")


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.