Re: PostgeSQL problems (Boolean vs Bit)

From: Doychi (doychi-list..oychi-dina.ath.cx)
Date: Wed Nov 09 2005 - 06:44:14 EST

  • Next message: Gentry, Michael \(Contractor\): "RE: PostgeSQL problems (Boolean vs Bit)"

    Thanks for the quick response. Keep up the good work.

    On 21:33:50 2005-11-09 Andrus Adamchik <andru..bjectstyle.org> wrote:
    > I found why our tests never detected this problem - in Cayenne
    > internally JDBC "BIT" column is mapped to PostgreSQL "boolean".
    > However I can easily reproduce the problem by other means.
    > Unfortunately there is no Cayenne solution - it seems like Postgres
    > PreparedStatement simply doesn't support bit columns (I may need to
    > poke around driver sources, maybe there is a way around?)
    >
    > Anyway, there is an easy fix on Postgres end - change "bit" columns
    > to "boolean" in your table definition, leaving Cayenne mapping
    > unchanged.
    >
    > Andrus
    >
    >
    >
    > On Nov 9, 2005, at 8:37 AM, Doychi wrote:
    > > Hi All,
    > >
    > > I seem to be having some problems with PostgeSQL (8.1) and Cayenne
    > > 1.2(M7).
    > > I get the error (more details give below):
    > >
    > > java.sql.SQLException: ERROR: column "active" is of type bit but
    > > expression
    > > is of type boolean
    > >
    > > when I try to add a new user to my user table.
    > >
    > > CREATE TABLE users
    > > (
    > > active bit(1) NOT NULL,
    > > administrator bit(1) NOT NULL,
    > > email varchar(128) NOT NULL,
    > > id int4 NOT NULL,
    > > name varchar(50) NOT NULL,
    > > "password" char(256) NOT NULL,
    > > CONSTRAINT users_pkey PRIMARY KEY (id)
    > > )
    > >
    > > I've set the modeler's db type for active and administrator to
    > > "BIT", and
    > > the Java type to "java.lang.Boolean". Is this correct?
    > >
    > > I did notice that there is an old closed bug in JIRA (http://
    > > objectstyle.org/jir
    > > a/secure/ViewIssue.jspa?key=CAY-55) that sounds like the same
    > > problem. Did
    > > some
    > > thing creep back in? If so is there a file I can modify to fix
    > > this problem unt
    > > il the next mile stone?
    > >
    > > PS: I love Cayenne and am currently working on a project with
    > > Cayenne and
    > > Click and except for some teething problems I'm loving it.
    > >
    > > java.sql.SQLException: ERROR: column "active" is of type bit but
    > > expression
    > > is of type boolean
    > > at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorRespons
    > e
    > > (QueryExecut orImpl.java:1471)
    > > at org.postgresql.core.v3.QueryExecutorImpl.processResults
    > > (QueryExecutorImpl .java:1256)
    > > at org.postgresql.core.v3.QueryExecutorImpl.execute
    > > (QueryExecutorImpl.java:1 75)
    > > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
    > > (AbstractJdbc2Statemen t.java:389)
    > > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
    >
    > > (AbstractJdbc 2Statement.java:330)
    > > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate
    > > (AbstractJdbc2St atement.java:282)
    > > at
    > > org.objectstyle.cayenne.access.jdbc.BatchAction.runAsIndividualQuer
    > ies
    > > (Ba tchAction.java:212)
    > > at org.objectstyle.cayenne.access.jdbc.BatchAction.performActio
    > n
    > > (BatchAction .java:117)
    > > at org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery
    > > (DataNodeQuery Action.java:95)
    > > at org.objectstyle.cayenne.access.DataNode.performQueries
    > > (DataNode.java:310) at
    > > org.objectstyle.cayenne.access.DataContextCommitAction.commit
    > > (DataContext CommitAction.java:181)
    > > at org.objectstyle.cayenne.access.DataContext.commitChanges
    > > (DataContext.java :950)
    > >
    > > --
    > > Doychi
    > > spdoychia..oychi-dina.ath.cx



    This archive was generated by hypermail 2.0.0 : Wed Nov 09 2005 - 06:44:19 EST