You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Gelhar, Wallace Joseph" <GE...@uwec.edu> on 2003/12/16 22:26:58 UTC
OJB does not respect the jdbc-type declared in the repository
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
Re: OJB does not respect the jdbc-type declared in the repository
Posted by Armin Waibel <ar...@code-au-lait.de>.
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