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 Bobby Lawrence <ro...@jlab.org> on 2005/04/19 17:25:09 UTC

simple string[]

Having a little difficulty w/ this...
How would I map a collection or array of Strings in a class?
I have a person object and I have a member variable called "emails" that 
is a String[] type.
How would I set up my class-descirptor to get this to work without 
having to create a bean to only store the email string?

-- 
----------------------------
Bobby Lawrence





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


Re: simple string[]

Posted by Armin Waibel <ar...@apache.org>.
Hi Bobby,

think with a FieldConversion this will not be possible to realize. There 
was a similar post some days ago. Sorry, currently I don't know a way to 
handle this without a bean class.

Please make a feature request (if there wasn't one for this) on jira.

regards,
Armin

Bobby Lawrence wrote:
> Thanx Dave, but the emails are not stored as comma seperated values in 
> the database.
> They have a seperate table:
> person_id int, email varchar
> I need to map the table.  I will try to play w/ the FieldConversions...
> --Bobby
> 
> 
> Dave Sunerton-Burl wrote:
> 
>> Bobby Lawrence wrote:
>>
>>> Having a little difficulty w/ this...
>>> How would I map a collection or array of Strings in a class?
>>> I have a person object and I have a member variable called "emails" 
>>> that is a String[] type.
>>> How would I set up my class-descirptor to get this to work without 
>>> having to create a bean to only store the email string?
>>>
>> I would recommend implementing FieldConversion where you store a 
>> string in the database (e.g. emails separated by commas) and write 
>> your FieldConversion class to convert between delimited String and 
>> String[]. Here's the details;
>> http://db.apache.org/ojb/docu/guides/jdbc-types.html#field-conversion
>>
>> If you get the OJB code, you can use one of the classes in the 
>> org.apache.ojb.broker.accesslayer.conversions package as an example 
>> starting point.
>>
>> Dave Sunerton-Burl
>> Lledr Solutions
>>
>> Email : dave@lledr-solutions.co.uk
>> Phone : +44 (0)1690 750446
>> Web : www.lledr-solutions.com
>>
>> ---------------------------------------------------------------------
>> 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: simple string[]

Posted by Bobby Lawrence <ro...@jlab.org>.
Thanx Dave, but the emails are not stored as comma seperated values in 
the database.
They have a seperate table:
person_id int, email varchar
I need to map the table.  I will try to play w/ the FieldConversions...
--Bobby


Dave Sunerton-Burl wrote:

> Bobby Lawrence wrote:
>
>> Having a little difficulty w/ this...
>> How would I map a collection or array of Strings in a class?
>> I have a person object and I have a member variable called "emails" 
>> that is a String[] type.
>> How would I set up my class-descirptor to get this to work without 
>> having to create a bean to only store the email string?
>>
> I would recommend implementing FieldConversion where you store a 
> string in the database (e.g. emails separated by commas) and write 
> your FieldConversion class to convert between delimited String and 
> String[]. Here's the details;
> http://db.apache.org/ojb/docu/guides/jdbc-types.html#field-conversion
>
> If you get the OJB code, you can use one of the classes in the 
> org.apache.ojb.broker.accesslayer.conversions package as an example 
> starting point.
>
> Dave Sunerton-Burl
> Lledr Solutions
>
> Email : dave@lledr-solutions.co.uk
> Phone : +44 (0)1690 750446
> Web : www.lledr-solutions.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>

-- 
----------------------------
Bobby Lawrence
MIS Application Developer

Jefferson Lab (www.jlab.org)

 Email: robertl@jlab.org
Office: (757) 269-5818
 Pager: (757) 584-5818
----------------------------





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


Re: simple string[]

Posted by Dave Sunerton-Burl <da...@lledr-solutions.co.uk>.
Bobby Lawrence wrote:
> Having a little difficulty w/ this...
> How would I map a collection or array of Strings in a class?
> I have a person object and I have a member variable called "emails" that 
> is a String[] type.
> How would I set up my class-descirptor to get this to work without 
> having to create a bean to only store the email string?
> 
I would recommend implementing FieldConversion where you store a string 
in the database (e.g. emails separated by commas) and write your 
FieldConversion class to convert between delimited String and String[]. 
Here's the details;
http://db.apache.org/ojb/docu/guides/jdbc-types.html#field-conversion

If you get the OJB code, you can use one of the classes in the 
org.apache.ojb.broker.accesslayer.conversions package as an example 
starting point.

Dave Sunerton-Burl
Lledr Solutions

Email : dave@lledr-solutions.co.uk
Phone : +44 (0)1690 750446
Web : www.lledr-solutions.com

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