« Return to Thread: @IndexColumn vs OrderColumn

Re: @IndexColumn vs OrderColumn

by Andrei Ilitchev :: Rate this Message:

| View in Thread

As per JPA 2.0 spec. (11.1.39 OrderColumn Annotation): "The order column
value for the first element of the list must be 0."

On 6/26/2012 11:59 AM, vaidya nathan wrote:

> I didnt explain it clearly.. In hibernate we are able to set the "POS"
> attribute clearly (like "POS"=1 in the example). How can I do that in
> eclipselink(By default it is set to "0" and i would like to change it
>
> Cheers
> Vaidya
>
>
> On Tue, Jun 26, 2012 at 10:03 AM, Andrei Ilitchev
> <andrei.ilitchev@...>  wrote:
>> That should work.
>> Note that "POS" field should be defined in join table "CATS_CAT".
>>
>>
>> On 6/25/2012 5:44 PM, vaidya nathan wrote:
>>>
>>> Hi All,
>>>
>>> We are having the following entity in hibernate
>>>
>>> @Entity(name="CATS")
>>> public class Categories
>>> {
>>>
>>>   @OneToMany(fetch=FetchType.EAGER,
>>> cascade={CascadeType.MERGE,CascadeType.PERSIST})
>>>      @JoinTable(name="CATS_CAT",
>>> joinColumns=@JoinColumn(name="CATS_ID"),
>>> inverseJoinColumns=@JoinColumn(name="CATEGORIES_ID"))
>>>      @IndexColumn(name="POS", base=1)
>>>
>>>
>>>      private List<Category>    categories ;
>>>
>>> }
>>>
>>> and we want to convert them to eclipselink..
>>>
>>> @Entity(name="CATS")
>>> public class Categories
>>> {
>>>
>>>   @OneToMany(fetch=FetchType.EAGER,
>>> cascade={CascadeType.MERGE,CascadeType.PERSIST})
>>>      @OrderColumn(name="POS")
>>>      @JoinTable(name="CATS_CAT",
>>> joinColumns=@JoinColumn(name="CATS_ID"),
>>> inverseJoinColumns=@JoinColumn(name="CATEGORIES_ID"))
>>>      @PrivateOwned
>>>
>>>      private List<Category>    categories ;
>>>
>>> }
>>>
>>>
>>> The issue that we are having is with the Order Column . We are not
>>> able to set the POS attribute on the OrderColumn annotation. Is there
>>> a way to do this in eclipselink?
>>>
>>> Otherwise we have to go through loops trying to get the tests running
>>> with both these technologies since the entities are kind of shared
>>> between the two implementations and we just have two different entity
>>> managers working on the same set of entities.
>>>
>>> Thx
>>> _______________________________________________
>>> eclipselink-users mailing list
>>> eclipselink-users@...
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@...
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@...
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

 « Return to Thread: @IndexColumn vs OrderColumn