-->
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: PostgreSQL insert booleans fail
PostPosted: Mon Mar 15, 2004 1:15 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:50 pm
Posts: 45
Location: US: New York NY
Maybe someone will know why when I do an update my boolean fields are getting mapped as "true" and "false" and not 1 and 0 when doing inserts or updates.

I'm using Hibernate 2.1.2

I have configured hibernate as so:

hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class org.postgresql.Driver
hibernate.connection.url jdbc:postgresql://localhost:5432/acms
hibernate.connection.username acms
hibernate.connection.password acms
hibernate.query.substitutions true 1, false 0

I even tried
hibernate.query.substitutions true=1, false=0,1=true,0=false
and
hibernate.query.substitutions true=1, false=0

My boolean fields look like so:

<property
name="useBot"
type="boolean"
update="true"
insert="true"
column="use_bot"
/>

The columns are numeric(1), values 0 or 1

Debug shows the following...
11:52:26,322 DEBUG BooleanType:46 - binding 'false' to parameter: 2
11:52:26,322 DEBUG BooleanType:46 - binding 'false' to parameter: 3
11:52:26,322 DEBUG BooleanType:46 - binding 'false' to parameter: 4


Which gives me the following error:
java.sql.SQLException: ERROR: Bad numeric input format 'f'

I do not have any error getting the fields from the db, only on insert and update.

If an answer to this is in a post or a doc, simply post the link. Thanks for any help.


Top
 Profile  
 
 Post subject: never mind... found the problem
PostPosted: Mon Mar 15, 2004 4:39 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:50 pm
Posts: 45
Location: US: New York NY
shouldn't map boolean to numeric(1), use boolean in db.

http://forum.hibernate.org/viewtopic.ph ... ql+boolean


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.