Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @IndexColumn vs OrderColumn

@OrderColumn annotation is defined by the spec and all spec. complaint providers (Eclipselink and Hibernate included) required to implement it in the manner defined by the spec.

Each time a vendor-specific (non spec. defined) annotation is used there is a chance that the other vendors won't support exactly the same functionality.

From Eclipselink perspective it doesn't make sense to define a proprietary annotation that would do exactly the same as @OrderColumn does plus shift option.

I've never heard anyone requiring this option before, but if it's something that many people want then may be file an enhancement request with the spec. to add a shift parameter to @OrderColumn in a future spec. release.

Thanks,
Andrei

On 6/26/2012 1:17 PM, vaidya nathan wrote:
So i guess hibernate gives the flexibility to override the POS
attribute whereas eclipselink doesnt ?

On Tue, Jun 26, 2012 at 11:40 AM, Andrei Ilitchev
<andrei.ilitchev@xxxxxxxxxx>  wrote:
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@xxxxxxxxxx>    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@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top