orderBy « Map « JPA Q&A





1. Hibernate @OrderBy with referenced class    stackoverflow.com

I have a class say: "ClassA" which has a collection of "ClassB"

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "COLUMN_NAME")    
private List<ClassB> lotsOfClasses;
"ClassB" has a mapped class "ClassC" using ...

2. Wrong query generated with @OrderBy annotation    stackoverflow.com

I am using Hibernate3 and i have an entity with the following collection:

@ManyToMany  
@JoinTable(name = "buys_publishers", joinColumns=@JoinColumn(name="buy_id", referencedColumnName = "buy_id"), inverseJoinColumns=@JoinColumn(name = "publisher_id", referencedColumnName = "publisher_id"))  
@OrderBy("name") ...

3. eclipselink @orderby Comparable    stackoverflow.com

let be the following entities:

@Entity
public class Person {
    @Id
    long id;

    @ManyToOne
    Family fam;

    @ManyToOne
  ...

4. JPA: @OrderBy bypassed by cache?    coderanch.com

It appears that the @OrderBy annotation on a @OneToMany LinkedList member of an @Entity does not work when another item is added last to the list by a @Stateless session bean. The next access (by later HTTP request to a @Stateless session bean) calling myEntityManager.find will see an unsorted list. Restarting the app server solves the problem. My guess is that ...

5. Question on sorting with @OrderBy    forum.hibernate.org

6. alternative to @OrderBy    forum.hibernate.org

Hey Everyone, Seems as though using the orderby clause on some association in an entity class is a horrible idea. I mean I don't know the ordering of the association that needs to be maintained. Any other alternatives to this? Can we do some criteria query or what not? And this is for the case with multiple associations that need to ...

7. @OrderBy: property from @OrderBy clause not found    forum.hibernate.org

I am getting an odd error when trying to use the @OrderBy annotation. I am getting an exception saying the updated field doesn't exist, as best I can decipher it anyways. If it matters, I am using postgresql 8.4 for the database. Also, the hibernate version is 3.5.5. Does anyone see any obvious reasons I would be getting this error message? ...

8. Wrong query generated with @OrderBy annotation    forum.hibernate.org

Hi, I am using Hibernate3 and i have an entity with the following collection: Code: @ManyToMany(fetch=FetchType.LAZY,cascade = { CascadeType.MERGE, CascadeType.PERSIST}) @JoinTable(name = "buys_publishers", joinColumns=@JoinColumn(name="buy_id", referencedColumnName = "buy_id"), inverseJoinColumns=@JoinColumn(name = "publisher_id", referencedColumnName = "publisher_id")) @OrderBy("name") private List publishers; The target entity (Publisher) inherits from an entity that holds the "name" attribute on which ...

9. @OrderBy annotation and Criteria API    forum.hibernate.org

Hello, I'm using Hibernate 3.3 and everything works more or less :) But I found that Hibernate is adding an "order by" when using the criteria API because one of the entity used in the criteria has an @OrderBy annotation. This is a problem because I'm using "avg" function and "group by", so my the generated sql doesn't work because I ...





10. Help using @OrderBy annotation    forum.hibernate.org

public class SurveyQuestion { private int questionNumber; } public class SurveyResponse { // appropriate getter exists and is mapped to the SurveyQuestion class private SurveyQuestion question; int responseOrder; SurveyHeader header; @ManyToOne() @JoinColumn(name="ResponseID", nullable=false) public SurveyHeader getHeader () { return ...

11. @orderBy doesnt work    forum.hibernate.org

Beginner Joined: Tue Aug 21, 2007 4:58 am Posts: 27 This is the class, and no I havent tried to order by other field....I will try as soon as I can. Code: package com.telvent.padron.bi.territorio.model; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import ...

12. Nested @OrderBy    forum.hibernate.org

13. @orderby sql server 2005 arrayList usage    forum.hibernate.org

14. @OrderBy an object property of a collection    forum.hibernate.org

How to sort a collection based on a property in a object in that collections. For instance, I have a many-to-one relationship between PERSON and JOB. I want to return a collection of JOB based on the first name in the PERSON table.. In the PERSON class, jobCollection with @OrderBy("Person.firstName") doesn't work..

15. @OrderBy, on field of sub-collection .. still not supported?    forum.hibernate.org

@Entity @Table(name = "establishment") public class Establishment { private Set establishmentResidueTypes; ... @OneToMany(cascade = { CascadeType.ALL }) @JoinColumn(name="idEstablishment") @OrderBy("residueType.description ASC") getEstablishmentResidueTypes () { ... } ... } public class EstablishmentResidueType { private Establishment ...