db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <ar...@code-au-lait.de>
Subject Re: OJB does not respect the jdbc-type declared in the repository
Date Wed, 17 Dec 2003 00:33:25 GMT
Hi Wally,

 > Repository:	INTEGER
that's the only important entry.
And jdbc/java types mapping say
(http://db.apache.org/ojb/jdbc-types.html)

INTEGER database type map to int/Integer java type

 > OJB does not respect the repository and returns a java.lang.Short
 > instead of a java.lang.Integer.

Sounds strange. Do you use a field conversion?
Used OJB version?

 > repository, so is it now best practice to just leave the <jdbc-type>
 > attribute out of the repository?

I recommend to set the types further on. It's possible for the standard 
types (short, int, long, ...). OJB read the java type from the pc object 
field and map this to the associated jdbc type, but if your field 
contains e.g. a String field, then OJB has to make a decision between 
CHAR, VARCHAR, LONGVARCHAR jdbc type.

Have a look in ...broker.util.JdbcTypesHelper class to see more detailed 
how we map java/jdbc types (maybe you will find a wrong mapping).

regards,
Armin


Gelhar, Wallace Joseph wrote:
> Hi All,
> 
> I've noticed a bug loading an object with the following types:
> 
> Database:	tinyint (1 byte integer)
> Repository:	INTEGER
> Object:	Integer 
> 
> OJB does not respect the repository and returns a java.lang.Short
> instead of a java.lang.Integer.  Is OJB pulling the attribute type from
> the jdbc type?  I know a while back a contribution was made to allow OJB
> to query jdbc to determine the attribute type if not specified in
> repository, so is it now best practice to just leave the <jdbc-type>
> attribute out of the repository?
> 
> Wally
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message