-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-17693 Fix typecheck assertions for converted properties
Also introduce a custom `DurationJdbcType`, mainly for validation purposes.
- Loading branch information
Showing
10 changed files
with
79 additions
and
26 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
42 changes: 42 additions & 0 deletions
42
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/DurationJdbcType.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,42 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html | ||
*/ | ||
package org.hibernate.type.descriptor.jdbc; | ||
|
||
import java.sql.Types; | ||
import java.time.Duration; | ||
|
||
import org.hibernate.type.SqlTypes; | ||
import org.hibernate.type.descriptor.WrapperOptions; | ||
|
||
/** | ||
* Descriptor for {@link java.time.Duration}. | ||
* | ||
* @author Marco Belladelli | ||
*/ | ||
public class DurationJdbcType extends NumericJdbcType { | ||
public static final DurationJdbcType INSTANCE = new DurationJdbcType(); | ||
|
||
@Override | ||
public int getDdlTypeCode() { | ||
return Types.NUMERIC; | ||
} | ||
|
||
@Override | ||
public int getDefaultSqlTypeCode() { | ||
return SqlTypes.DURATION; | ||
} | ||
|
||
@Override | ||
public String getFriendlyName() { | ||
return "DURATION"; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DurationJdbcType"; | ||
} | ||
} |
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