I'm trying to map an object that has a String array property into two
tables. By way of simple example, what I have is something like:

public class Car {
private String[] colors = {"red", "green". "taupe"};
private String car_name;

public String[] getColors() {
   return colors;
}
public String[] setColors() {
   this.colors = colors;
}
..more accessor methods...
}

I want to map my Car object and the one-to-many colors to tables like this:
car
car_id
car_name
etc...

colors
color_id - auto increment
car_id - ref to car_id in car table
color_name - the string value

So, can Castor do that? I have only ever mapped collections of my own
objects. So, for that, I would define how the object is mapped in my mapping
file and that way Castor know how to save the collection of objects in its
own table. I've not done a collection of Strings. Do I need to make a simple
wrapper class for Color? My guess is yes, but I just wanted to see if there
were any better solutions for mapping arrays of Strings to one-to-many
relationships.

Thanks!
Gregg



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to