Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

bit(1) conversion

callisto79May 6 2008 — edited May 10 2008
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


private int enabled;

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


I'd appreciate any help,
thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2008
Added on May 6 2008
4 comments
2,288 views