<<
Hibernate Help
I'm getting a constraint violation when deleting a parent object, even with cascade="all-delete-orphan"
Check that
inverse=true is set on the Parent object's mapping of the Set
How do I make Hibernate return results in a random order?
You need to extend the
org.hibernate.dialect.OracleDialect, and use the extended Dialect in the
hibernate.cfg.xml (or
persistence.xml):
1:
2:
3:
4:
5:
6:
public class OracleDialect extends org.hibernate.dialect.OracleDialect{
public OracleDialect() {
super();
registerFunction( "rand", new SQLFunctionTemplate( Hibernate.DOUBLE, "dbms_random.value" ) );
}
}
To enable the random ordering, add
order by rand() to the end of your HQL.