Hi Robert,

Robert Giddings wrote:
Hi Armin,

UserType is a complex object that is used as a property in other
objects. AccessRight is an enum.

The XDoclet I currently have is:

/**
         * @ojb.field jdbc-type="LONGVARCHAR"
conversion="org.apache.ojb.broker.accesslayer.conversions.Object2Base64S
tringFieldConversion"
         */
private EnumMap<AccessRight, Boolean> accessRights = new EnumMap<AccessRight, Boolean>(AccessRight.class);

I was just wondering if there is a better way of converting this
property?

hmm, you can write your own FieldConversion to optimize conversion
performance (java --> sql and vice versa).
E.g. persist key-value string ("read=true,write=true,delete=false") or only the values ("110") instead of the whole object.

An alternative would be a nested object
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Nested+Objects
with a Boolean field for each AccessRight. But a 'nested object' need a default constructor and it will be tricky to realize it with EnumMap<AccessRight, Boolean>. The advantage of a nested object is that you can search for each field (of a nested object) in queries.

regards,
Armin


Thanks,

Robert Giddings

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 16:40
To: OJB Users List
Subject: Re: Maps

Robert Giddings wrote:
Also forgot to mention, what I really want is the XDoclet code that
can
be used with Maps.


Sorry, I don't get it. How are UserType and AccessRight associated
(1:n?)?

Armin


Robert

-----Original Message-----
From: Robert Giddings [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 14:28
To: 'OJB Users List'
Subject: RE: Maps

Hi Armin,

This is the Map in question:

private EnumMap<AccessRight, Boolean> accessRights = new EnumMap<AccessRight, Boolean>(AccessRight.class);

It is just a data member field in an object called UserType.

Thanks,

Robert

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 14:00
To: OJB Users List
Subject: Re: Maps

Hi Robert,

Robert Giddings wrote:
Hi,

Does anyone know if and how OJB can handle Maps?

can you describe more detailed what you want to do - using maps in 1:n

or m:n references, direct persist maps, ...

regards,
Armin

Thanks,

Rob


---------------------------------------------------------------------
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]





---------------------------------------------------------------------
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]

Reply via email to