JPA: @OrderColumn and the visible state of the object?

This is the next question:

Is @ManyToMany (mappedBy = ...) + @OrderColumn supported by JPA?

I mean the @OrderColumn Java @OrderColumn :

http://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html

The text is the same as the JPA 2 specification in section 11.1.39 of Annotation OrderColumn.

What does it mean that the “order column is not displayed as part of the state of the object” part means exactly ? There is a lot of room for interpretation.

Does this mean that the order column should not be part of any FK and / or PKs? Or just not in FK (PK allowed)? What is the state of the organization? The AFAIK JPA specification does not define this.

thanks

0
java hibernate jpa eclipselink
source share
2 answers

The order column is not a field of the Entity (es) class, so it is not displayed (as such).

+1
source share

OpenJPA. Look at this code, this is the best way to understand

 //This is in the parent table @OneToMany(cascade = CascadeType.ALL, mappedBy = "parentTable", fetch = FetchType.EAGER) @OrderColumn private ArrayList<child_class_type> childTable = new ArrayList<child_class_type>(); //This is in the child table @ManyToOne(fetch = FetchType.EAGER, optional = false) private parentTableClass parentTable; 

This will get an ordered list (child table). :)

John W., Col

+1
source share

All Articles