Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: Annotations beta3 + Hibernate 3.0.5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I read the annotations documentation and wanted to make sure I understood it correctly. The @OrderBy will only work if the entity class that is of the collection does not reference any other tables. For example:
Code:
public class Gender
{
public GenderType type;
public Date cDate;
public Person person;
@ManyToOne
public Person getPerson()
{
}
@ManyToOne
public GenderType getType()
{
}
}
public class Person
{
public List<Gender> genders;
@OneToMany(mappedBy = "person")
@OrderBy("cDate asc")
public List<Gender> getGenders()
{
...
}
}
The @OrderBy will have no effect because the Gender class has another GenderType association. Am I understanding this correctly? Thanks!