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 "Morley, Liam " <lm...@WPI.EDU> on 2004/06/27 04:29:50 UTC
mapping fields to an array
We've got a db table with a structure like this:
Name
Address
SSN
Field1
Field2
...
Field30approx
The guy who designed the java class for this (a bit more of a C-style programmer than I am) wrote a class structure like this:
String name;
Address address;
String ssn;
int[] fields;
where fields is an array of length 30 that has the values of fields 1 through 30. (The fields actually have individual names, not Field1 Field2 etc.)
is there a way to map my fields to an array, or do i have to have 30 internal variables?
--
Liam Morley
lmorley@wpi.edu
RE: mapping fields to an array
Posted by "Morley, Liam " <lm...@WPI.EDU>.
Thanks for the reply. It looks like I also may have to use a Rowreader to correctly store nested objects as well, so I may very well choose that approach. Thanks again.
--
Liam Morley
From: Thomas DudziakSent: Sun 6/27/04 4:58 AMTo: OJB Users ListSubject: Re: mapping fields to an array
Morley, Liam wrote:
> We've got a db table with a structure like this:
>
> Name
> Address
> SSN
> Field1
> Field2
> ...
> Field30approx
>
>
> The guy who designed the java class for this (a bit more of a C-style programmer than I am) wrote a class structure like this:
>
> String name;
> Address address;
> String ssn;
> int[] fields;
>
>
> where fields is an array of length 30 that has the values of fields 1 through 30. (The fields actually have individual names, not Field1 Field2 etc.)
>
> is there a way to map my fields to an array, or do i have to have 30 internal variables?
AFAIK the only way to do so is to use a custom row-reader implementation
for the class. Check here for details:
http://db.apache.org/ojb/docu/advanced-technique.html#using-rowreader
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: mapping fields to an array
Posted by Thomas Dudziak <to...@first.fhg.de>.
Morley, Liam wrote:
> We've got a db table with a structure like this:
>
> Name
> Address
> SSN
> Field1
> Field2
> ...
> Field30approx
>
>
> The guy who designed the java class for this (a bit more of a C-style programmer than I am) wrote a class structure like this:
>
> String name;
> Address address;
> String ssn;
> int[] fields;
>
>
> where fields is an array of length 30 that has the values of fields 1 through 30. (The fields actually have individual names, not Field1 Field2 etc.)
>
> is there a way to map my fields to an array, or do i have to have 30 internal variables?
AFAIK the only way to do so is to use a custom row-reader implementation
for the class. Check here for details:
http://db.apache.org/ojb/docu/advanced-technique.html#using-rowreader
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org