users@glassfish.java.net

bit(1) conversion

From: <glassfish_at_javadesktop.org>
Date: Mon, 05 May 2008 15:25:32 PDT

I'm having difficulties with SQL to POJO Datatype Conversion.

I'm using Glassfish V2 UR1 and a Postgres DBMS and I stick to the standard EJB3 implementation of Toplink.

I have a table named User with a column named enabled, which is of type bit(1).

I have tried several Java types but none of them does the clou (below is a list of types and the corresponding Exception Messages I get):


@Column(name = "enabled", nullable = false)
private boolean enabled;

Caused by: org.postgresql.util.PSQLException: ERROR: column "enabled" is of type bit but expression is of type boolean


private Character enabled;

Exception Description: The object [true], of class [class java.lang.Boolean], from mapping [oracle.toplink.essentials.mappings.DirectToFieldMapping[enabled-->user.enabled]] with descriptor [RelationalDescriptor(com.test.ejb.orm.User --> [DatabaseTable(user)])], could not be converted to [class java.lang.Character].


private Boolean enabled;

Caused by: org.postgresql.util.PSQLException: ERROR: column "enabled" is of type bit but expression is of type boolean


I'd appreciate any help,
thanks in advance.
[Message sent by forum member 'callisto79' (callisto79)]

http://forums.java.net/jive/thread.jspa?messageID=272846