-->
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.  [ 6 posts ] 
Author Message
 Post subject: How to map a bit field
PostPosted: Thu Aug 09, 2007 10:08 am 
Newbie

Joined: Thu Aug 09, 2007 9:50 am
Posts: 9
Hi everybody

I am new in this forum so first of all sorry if I do something wrong.

I am also new with hibernate. I have read some tutorials and at least I have it running with a very simple application. I use hibernate 3.2, postgresql 8.1 and Eclipse 3.3 with java jdk 1.6.

My problem is that I have a bit field in my database and I want to use hibernate to set it. How can I do it? I mean, which java type should I use? I have tested with String, long, etc... but it always crashes. Any ideas?

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 12:32 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
boolean

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 1:20 pm 
Newbie

Joined: Thu Aug 09, 2007 9:50 am
Posts: 9
Thanks for your answer.

I think I didn't explain my problem very well. I have a bit(64) column in my database. That is, a 64 length string of bits.

If I want to insert a new record in the postgresql database I must write:

Code:
INSERT INTO table (column) VALUES ('b01101000....010');


I don't know which java type is this bit(64). I have tried creating a String variable and setting it to 'b0110100..010' but it didn't work. Any ideas?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 11, 2007 6:13 am 
Newbie

Joined: Thu Aug 09, 2007 9:50 am
Posts: 9
No ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 11, 2007 7:35 am 
Newbie

Joined: Mon Jul 30, 2007 10:12 pm
Posts: 13
Location: Orust/Sweden
Perhaps you should read this first

http://www.xaprb.com/blog/2006/04/11/bit-values-in-mysql/


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 08, 2007 1:00 pm 
Newbie

Joined: Sat Sep 08, 2007 12:44 pm
Posts: 1
Hello,

I have the same issue of the author of this thread: I need a Hibernate mapping for the bit varying type of Postgresql. Has anyone had the same issue and found a solution? Whether bit fields are bad practice or not doesn't help me much, as I'm mapping to a database I cannot change. I'll be resorting to pure JDBC in the meanwhile...

Thanks!


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