-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 3 + annotations + PostgreSQL + ... boolean =error?
PostPosted: Fri Apr 22, 2005 4:03 pm 
Newbie

Joined: Fri Apr 22, 2005 3:39 pm
Posts: 18
Greetings!

I'm really confused, and not sure of the origin of the problem:

I'm using:
Hibernate 3.0, PostgreSQL 8.0 windows server, 8.0 jdbc3 driver, hibernate annotations beta. I call ShemaExport programmaticaly (using AnnotationConfiguration) to generate DDL for, say:

@Entity
class MyEntity
{
private long id;
private boolean activated;
/* other fields*/

@Id(generate=GeneratorType.AUTO)
/* id getter */
/* id setter */
@Basic
public boolean isActivated(){return activated;}
public void setActivated(boolean v){activated=v;}

/*other fields' getters/setters*/
}

The boolean value activated is mapped by ShemaExport to SQL BIT(1) (eqivalent to SQL BIT) and I all attempts to save an instance of MyEntity fail. Queries like "from MyEntity en where en.activated = false" fail too because of the same reason. Is there a cure for this? Am I doing something wrong? I'm really confused... The entity operates OK without that boolean field!



Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [persistent.MyEntity]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1882)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2214)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at Test.main(Test.java:150)
Caused by: java.sql.SQLException: ERROR: column "activated" is of type bit but expression is of type boolean
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1365)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1160)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:172)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:387)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:328)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:280)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1866)
... 11 more


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2005 6:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
have you set the proper diaclect ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Sorry...
PostPosted: Mon Apr 25, 2005 3:19 am 
Newbie

Joined: Fri Apr 22, 2005 3:39 pm
Posts: 18
max wrote:
have you set the proper diaclect ?

I'm so ashame but I have mistaken progress and postgre dialects... :-) Sorry to bother you.

By the way, you guys rule! Thanx!


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