Here are the examples of the java api org.hibernate.NullPrecedence.FIRST taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
16
Source : SQLServer2008Dialect.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls) {
final StringBuilder orderByElement = new StringBuilder();
if (nulls != null && !NullPrecedence.NONE.equals(nulls)) {
// Workaround for NULLS FIRST / LAST support.
orderByElement.append("case when ").append(expression).append(" is null then ");
if (NullPrecedence.FIRST.equals(nulls)) {
orderByElement.append("0 else 1");
} else {
orderByElement.append("1 else 0");
}
orderByElement.append(" end, ");
}
// Nulls precedence has already been handled so preplaceding NONE value.
orderByElement.append(super.renderOrderByElement(expression, collation, order, NullPrecedence.NONE));
return orderByElement.toString();
}