Armin Waibel
Wed, 20 Feb 2008 05:47:04 -0800
Hi Johan, Johan Andersson wrote:
Greetings! Say I have a class MyClass it looks like this: public class MyClass { private int id;private String name; private List<Integer> myIntegers = new ArrayList<Integer>;/* getters and setters omitted ... */ } What options do I have if I want to persist this class using OJB?The List<Integer> is causing me problems since it is not a pesistent entity class. Requirements impede me from just putting it into one field and use a IntList2VarcharFieldConversion. Requrements want me to have the List<Integer> data in a separate database table.But I just cant figure out how to map this.
Sorry, to have the List<Integer> data in a separate database table is not supported by OJB. In this case OJB expect a persistence capable class e.g. Items. regards, Armin
Here's my tables (I am using MySQL): CREATE TABLE `MY_CLASS` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ); CREATE TABLE `ITEMS` ( `my_class_id` int(10) unsigned NOT NULL, `item_id` int(10) unsigned NOT NULL, PRIMARY KEY (`my_class_id`, `item_id`) ); Thankful for any suggestions. /JOHAN --------------------------------------------------------------------- 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]