Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-465 - Support for NULLS FIRST/LAST
- Loading branch information
1 parent
caf2ee4
commit add6aea
Showing
27 changed files
with
868 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
hibernate-core/src/main/java/org/hibernate/NullPrecedence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.hibernate; | ||
|
||
/** | ||
* Defines precedence of null values within {@code ORDER BY} clause. | ||
* | ||
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) | ||
*/ | ||
public enum NullPrecedence { | ||
/** | ||
* Null precedence not specified. Relies on the RDBMS implementation. | ||
*/ | ||
NONE, | ||
|
||
/** | ||
* Null values appear at the beginning of the sorted collection. | ||
*/ | ||
FIRST, | ||
|
||
/** | ||
* Null values appear at the end of the sorted collection. | ||
*/ | ||
LAST; | ||
|
||
public static NullPrecedence parse(String type) { | ||
if ( "none".equalsIgnoreCase( type ) ) { | ||
return NullPrecedence.NONE; | ||
} | ||
else if ( "first".equalsIgnoreCase( type ) ) { | ||
return NullPrecedence.FIRST; | ||
} | ||
else if ( "last".equalsIgnoreCase( type ) ) { | ||
return NullPrecedence.LAST; | ||
} | ||
return null; | ||
} | ||
|
||
public static NullPrecedence parse(String type, NullPrecedence defaultValue) { | ||
final NullPrecedence value = parse( type ); | ||
return value != null ? value : defaultValue; | ||
} | ||
} |
Oops, something went wrong.