Mapping for type BIT broke afer upgrade from 1.0.1 to 1.0.4

2008-01-29 Thread Oliver Seimel
Hi,

we migrated from ojb 1.0.1 to 1.0.4
DB is Postgres. But I think, that the problem is independent
of the DB. 
We use the type BIT(1) for boolean values, so a mapping looks
like this:

field-descriptor
name=emailNotice
column=emailnotice
jdbc-type=BIT
/

With version 1.0.1 the generated SQL was
... WHERE emailnotice = '1' .

With version 1.0.4 the generated SQL is
... WHERE emailnotice = 'true' .

Thats not good, because the statement fails.

Does anybody know why ojb now maps the BIT types
to BOOLEAN? 

Thank you very much
Oliver


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Mapping for type BIT broke afer upgrade from 1.0.1 to 1.0.4

2008-01-29 Thread Oliver Seimel
 
Hi Armin,

 Oliver Seimel wrote:
  Hi,
  
  we migrated from ojb 1.0.1 to 1.0.4
  DB is Postgres. But I think, that the problem is 
 independent of the 
  DB.
  We use the type BIT(1) for boolean values, so a mapping looks like 
  this:
  
  field-descriptor
  name=emailNotice
  column=emailnotice
  jdbc-type=BIT
  /
  
  With version 1.0.1 the generated SQL was ... WHERE 
 emailnotice = '1' 
  .
  
  With version 1.0.4 the generated SQL is ... WHERE 
 emailnotice = 'true' 
  .
  
  Thats not good, because the statement fails.
  
  Does anybody know why ojb now maps the BIT types to BOOLEAN?
 
 OJB 1.0.4 and higher try to support the JDBC 3.0 
 specification which specify to map BIT to boolean 
 http://db.apache.org/ojb/docu/guides/jdbc-types.html
 Maybe this cause your problem.
 Could you please post the query/criteria which produce the 
 SQL shown above.

Thanks for your response! 

here is an example:

Criteria criteria = new Criteria();
criteria.addEqualTo(isCombination, new Boolean(true));
QueryByCriteria query = new QueryByCriteria(LicenseModule.class, criteria);
licenses = broker.getCollectionByQuery(query);

I changed it now to:
criteria.addEqualTo(isCombination, new Integer(1));

p6spy log tells me that it is now correct:
...WHERE isCombination = '1'

but I still get an exception:
...WHERE isCombination = ?'
* Exception message is [ERROR: operator does not exist: bit = integer]

This is strange at the first moment. I think OJB does everything right when
I use new Integer instead of new Boolean (because of the p6spy log - and 
Postgres
does accept the query of the log, if I use pgAdmin).
The Postgres log says:
LOG:  statement: SELECT 
A0.licenseid,A0.class_name,A0.baselicenseid,A0.name,A0.iscombination FROM 
License A0 WHERE isCombination =
$1
ERROR:  operator does not exist: bit = integer
HINT:  No operator matches the given name and argument type(s). You may need to 
add explicit type casts. 

the message is clear, but as I said, at the moment I don't understand why 
Postgres
does not accept the statement from ojb, but accepts it from pgadmin.
(Probably it is the driver's fault?)

So it seems it is not OJBs fault :)
but I would be pleased if someone could give me a hint.

Thanks
Oliver



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Mapping for type BIT broke afer upgrade from 1.0.1 to 1.0.4

2008-01-29 Thread Armin Waibel

Hi Oliver,

Oliver Seimel wrote:

Hi,

we migrated from ojb 1.0.1 to 1.0.4
DB is Postgres. But I think, that the problem is independent
of the DB. 
We use the type BIT(1) for boolean values, so a mapping looks

like this:

field-descriptor
name=emailNotice
column=emailnotice
jdbc-type=BIT
/

With version 1.0.1 the generated SQL was
... WHERE emailnotice = '1' .

With version 1.0.4 the generated SQL is
... WHERE emailnotice = 'true' .

Thats not good, because the statement fails.

Does anybody know why ojb now maps the BIT types
to BOOLEAN? 


OJB 1.0.4 and higher try to support the JDBC 3.0 specification which 
specify to map BIT to boolean

http://db.apache.org/ojb/docu/guides/jdbc-types.html
Maybe this cause your problem.
Could you please post the query/criteria which produce the SQL shown above.

regards,
Armin



Thank you very much
Oliver


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]