[prev in list] [next in list] [prev in thread] [next in thread]
List: ojb-user
Subject: Re: Mapping a List<Integer> (or Set<Integer>) with OJB.
From: Armin Waibel <arminw () apache ! org>
Date: 2008-02-20 13:46:42
Message-ID: 47BC2F42.2050608 () apache ! org
[Download RAW message or body]
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: 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic