You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Robert Giddings <r....@netcase.co.uk> on 2007/09/26 16:43:29 UTC
Maps
Hi,
Does anyone know if and how OJB can handle Maps?
Thanks,
Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Maps
Posted by Armin Waibel <ar...@apache.org>.
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:arminw@apache.org]
> 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:r.giddings@netcase.co.uk]
>> 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:arminw@apache.org]
>> 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: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Maps
Posted by Robert Giddings <r....@netcase.co.uk>.
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?
Thanks,
Robert Giddings
-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org]
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:r.giddings@netcase.co.uk]
> 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:arminw@apache.org]
> 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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date:
27/09/2007 17:00
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Maps
Posted by Armin Waibel <ar...@apache.org>.
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:r.giddings@netcase.co.uk]
> 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:arminw@apache.org]
> 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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Maps
Posted by Robert Giddings <r....@netcase.co.uk>.
Also forgot to mention, what I really want is the XDoclet code that can
be used with Maps.
Robert
-----Original Message-----
From: Robert Giddings [mailto:r.giddings@netcase.co.uk]
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:arminw@apache.org]
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date:
27/09/2007 17:00
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date:
27/09/2007 17:00
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Maps
Posted by Robert Giddings <r....@netcase.co.uk>.
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:arminw@apache.org]
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date:
27/09/2007 17:00
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Maps
Posted by Armin Waibel <ar...@apache.org>.
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org