-->
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.  [ 8 posts ] 
Author Message
 Post subject: handling booleans
PostPosted: Tue Aug 10, 2004 7:00 pm 
Newbie

Joined: Sat Feb 21, 2004 1:34 pm
Posts: 12
Location: Denver, Colorado
This is probably a simple question but my searches have not turned anything up.

I have a pre-existing oracle database where we store boolean values as 't' or 'f'. How do I map this properly in Hibernate so that the objects will utilize a boolean?

Thanks for your help.

Marcus


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 7:03 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
Did you read the documentation?

http://www.hibernate.org/hib_docs/refer ... ping-types

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 9:35 pm 
Newbie

Joined: Sat Feb 21, 2004 1:34 pm
Posts: 12
Location: Denver, Colorado
Yes I did, thank you for the useful reply.

Hibernate wants to store a 1 or a 0 for true or false which does not match what is needed. I need to store the boolean state as a t or an f and read it correctly.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 9:36 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
What version of hibernate are you using?
Can you show the mapping?

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 9:37 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
Also the DDL for the table that you are talking about.

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 9:52 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
Check out net.sf.hibernate.UserType

http://www.hibernate.org/hib_docs/api/

This interface should be implemented by user-defined "types". A "type" class is not the actual property type - it is a class that knows how to serialize instances of another class to and from JDBC.

Don't know why someone wouldn't set a boolean type in a db to be a bit type or something small like that since it only has 2 values!

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 10:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
type="true_false"

This is in the documentation!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 11:45 am 
Newbie

Joined: Sat Feb 21, 2004 1:34 pm
Posts: 12
Location: Denver, Colorado
thank you for the responses.

While it is definitely in the documentation, the documentation on this particular subject DOES NOT say how the boolean is handled in the database based on the type setting. It just says that the setting is available.

What is it with the negativity on this forum? This is the beginner's forum is it not? I get two smart ass answers to a simple question. Perhaps you should take your life's frustrations out on someone else or go see a shrink.

Again, thank you for the answer to this simple problem.


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