order « Field « JPA Q&A





1. Order By related object field    forum.hibernate.org

2. order by field in nested class    forum.hibernate.org

Hi all i'm beginners, i have to do a sort by a fiel in a nested class...i'll explain better. I've a class Node wich have a subclass Category with the following configuration ... @ManyToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinTable( name="category_node", joinColumns={@JoinColumn(name="nodeId")}, inverseJoinColumns={@JoinColumn(name="categoryId")} ) public Set getCategories() { return categories; } ... i extract some nodes and i have to order by 'name', a field ...

4. Order sql by calculated field    forum.hibernate.org

hi everyone, Im trying to order by a calculated field but has been no possible this is the code. String sqlCountUserActions = "..."; ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("id"),"id"); projList.add(Projections.property("name"),"name"); projList.add(Projections.sqlProjection(sqlCountUserActions, new String[] { "countActions" }, new org.hibernate.type.Type[] { Hibernate.LONG })); crit.addOrder((Order.asc("countActions"))); When I try this code always I got the error that 'countActions' doesnt exist in my class like a property... ...

5. Apply MySQL's ORDER BY FIELD In Hibernate    forum.hibernate.org

Hello. Currently I have a table with following schema: Code: +--------+------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------------------------+------+-----+---------+-------+ | id ...

7. Ordering of selected fields in     forum.hibernate.org

Hibernate version: 3.1 I have some named sql-query elements in my mapping. They work fine except that the items in the returned object array are in a different order than they are specified in the mapping. In this example, I would expect... [a][b][c] [a][b][c] [a][b][c]... Instead, I get... [c][a][b] [c][a][b] [c][a][b]... Code: ...

8. Informix order by fields not in select .. HQL    forum.hibernate.org

I notice that hibernate doesn't add the fields in the SELECT that are in the ORDER BY. It produces a syntax error when the query is executed in INFORMIX (it works for databases as Mysql). Some have experimented the same problem? Would be a solution to change the informix dialect ? How can I do? Thanks in advance.

9. invalid field in order by clause ?    forum.hibernate.org

I've created a very basic hibernate query Session session = HibernateSessionFactory.getInstance().getCurrentSession(); Transaction tx = session.beginTransaction(); List results = session.createQuery("from Blog as bl where bl.link=?").setString(0, uri).list(); This is expected to return a list of Blog objects with contains a one-to-many mapping of BlogPost objects. The Blog table has no datetime fields, the BlogPost table has a single datetime field called publishedDate Statements ...





10. How to order by a field in a one-to-many related entity    forum.hibernate.org

Heres the basic setup: (pseudocode) Class Kitten has 2 relevant fields to this example- name and birthdate. Now what I want to do, using criteria queries, is get a list of Cats, ordered by the name of the oldest kitten. I have been googling for about 6 hours now, and I've ...

11. How to do a 'substr' on a order field with criteria?    forum.hibernate.org

...

12. Hibernate *order of the fields of the class*    forum.hibernate.org