Hello,

> -----Original Message-----
> From: Joerg Lensing [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 26, 2003 10:12 AM
> To: OJB Users List
> Subject: mapping 
> 
> 
> hello,
> i have to map several fields which can have a limited number 
> of values. 
> e.g. "day of week" = mon,tue, wed..... Because of
> performance I don't want to store them as Strings. Integers 
> would be my 
> favorit datatype. But then i have

or maybe BYTE?

> to lookup for the meaning or the integers in my javacode. This is 
> something, i don't like.
> 
> Any hints? Does OJB support a machanism for this?
> 
> joerg

we have the same situation.
We use the "type-safe" enum pattern in our application,
i.e., a class DayOfWeek with a private constructor
and seven static fields of type DayOfWeek, namely MONDAY,
TUESDAY and so on.

Then we implement a class 
DayOfWeekToIntConversion implements 
org.apache.ojb.broker.accesslayer.conversions.FieldConversion

and declare that FieldConversion in the corresponding 
field-descriptor in repository_user.xml.

HTH,
        Olli




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

Reply via email to