Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Nested @OrderBy

 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have three hibernate object A, B and C

A {
@NotNull
@OneToMany
// @OrderBy How to do this based on sortOrder in Class C
private List<B> B = new ArrayList<B>();
}

B {
@NotNull
@ManyToOne
private C C;
}

C {
@Column(name = "SORT_ORDER")
private Integer sortOrder;
}

Is there a way I can get the List B @OrderBy based on the value in sortOrder column in Class C
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!