Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d82b336
commit 2b79644
Showing
28 changed files
with
342 additions
and
61 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
31 changes: 31 additions & 0 deletions
31
hibernate-core/src/main/java/org/hibernate/dialect/InnoDBStorageEngine.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,31 @@ | ||
package org.hibernate.dialect; | ||
|
||
/** | ||
* Represents the InnoDB storage engine. | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class InnoDBStorageEngine implements MySQLStorageEngine{ | ||
|
||
public static final MySQLStorageEngine INSTANCE = new InnoDBStorageEngine(); | ||
|
||
@Override | ||
public boolean supportsCascadeDelete() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getTableTypeString(String engineKeyword) { | ||
return String.format( " %s=InnoDB", engineKeyword ); | ||
} | ||
|
||
@Override | ||
public boolean hasSelfReferentialForeignKeyBug() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean dropConstraints() { | ||
return true; | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
hibernate-core/src/main/java/org/hibernate/dialect/MyISAMStorageEngine.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,31 @@ | ||
package org.hibernate.dialect; | ||
|
||
/** | ||
* Represents the MyISAM storage engine. | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class MyISAMStorageEngine implements MySQLStorageEngine{ | ||
|
||
public static final MySQLStorageEngine INSTANCE = new MyISAMStorageEngine(); | ||
|
||
@Override | ||
public boolean supportsCascadeDelete() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getTableTypeString(String engineKeyword) { | ||
return String.format( " %s=MyISAM", engineKeyword ); | ||
} | ||
|
||
@Override | ||
public boolean hasSelfReferentialForeignKeyBug() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean dropConstraints() { | ||
return false; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
hibernate-core/src/main/java/org/hibernate/dialect/MySQL55Dialect.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,20 @@ | ||
/* | ||
* 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.dialect; | ||
|
||
/** | ||
* An SQL dialect for MySQL 5.5.x specific features. | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class MySQL55Dialect extends MySQL5Dialect { | ||
|
||
@Override | ||
protected MySQLStorageEngine getDefaultMySQLStorageEngine() { | ||
return InnoDBStorageEngine.INSTANCE; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
hibernate-core/src/main/java/org/hibernate/dialect/MySQL57Dialect.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,76 @@ | ||
/* | ||
* 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.dialect; | ||
|
||
import java.sql.Types; | ||
|
||
import org.hibernate.dialect.function.SQLFunction; | ||
import org.hibernate.dialect.function.StaticPrecisionFspTimestampFunction; | ||
|
||
/** | ||
* @author Gail Badner | ||
*/ | ||
public class MySQL57Dialect extends MySQL55Dialect { | ||
public MySQL57Dialect() { | ||
super(); | ||
|
||
// For details about MySQL 5.7 support for fractional seconds | ||
// precision (fsp): http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html | ||
// Regarding datetime(fsp), "The fsp value, if given, must be | ||
// in the range 0 to 6. A value of 0 signifies that there is | ||
// no fractional part. If omitted, the default precision is 0. | ||
// (This differs from the standard SQL default of 6, for | ||
// compatibility with previous MySQL versions.)". | ||
|
||
// The following is defined because Hibernate currently expects | ||
// the SQL 1992 default of 6 (which is inconsistent with the MySQL | ||
// default). | ||
registerColumnType( Types.TIMESTAMP, "datetime(6)" ); | ||
|
||
// MySQL 5.7 brings JSON native support with a dedicated datatype. | ||
// For more details about MySql new JSON datatype support, see: | ||
// https://dev.mysql.com/doc/refman/5.7/en/json.html | ||
registerColumnType( Types.JAVA_OBJECT, "json" ); | ||
|
||
// MySQL also supports fractional seconds precision for time values | ||
// (time(fsp)). According to SQL 1992, the default for <time precision> | ||
// is 0. The MySQL default is time(0), there's no need to override | ||
// the setting for Types.TIME columns. | ||
|
||
// For details about MySQL support for timestamp functions, see: | ||
// http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html | ||
|
||
// The following are synonyms for now(fsp), where fsp defaults to 0 on MySQL 5.7: | ||
// current_timestamp([fsp]), localtime(fsp), localtimestamp(fsp). | ||
// Register the same StaticPrecisionFspTimestampFunction for all 4 functions. | ||
final SQLFunction currentTimestampFunction = new StaticPrecisionFspTimestampFunction("now", 6 ); | ||
|
||
registerFunction( "now", currentTimestampFunction ); | ||
registerFunction( "current_timestamp", currentTimestampFunction ); | ||
registerFunction( "localtime", currentTimestampFunction ); | ||
registerFunction( "localtimestamp", currentTimestampFunction ); | ||
|
||
// sysdate is different from now(): | ||
// "SYSDATE() returns the time at which it executes. This differs | ||
// from the behavior for NOW(), which returns a constant time that | ||
// indicates the time at which the statement began to execute. | ||
// (Within a stored function or trigger, NOW() returns the time at | ||
// which the function or triggering statement began to execute.) | ||
registerFunction( "sysdate", new StaticPrecisionFspTimestampFunction( "sysdate", 6 ) ); | ||
|
||
// from_unixtime(), timestamp() are functions that return TIMESTAMP that do not support a | ||
// fractional seconds precision argument (so there's no need to override them here): | ||
} | ||
|
||
/** | ||
* @see <a href="https://dev.mysql.com/worklog/task/?id=7019">MySQL 5.7 work log</a> | ||
* @return supports IN clause row value expressions | ||
*/ | ||
public boolean supportsRowValueConstructorSyntaxInInList() { | ||
return true; | ||
} | ||
} |
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
Oops, something went wrong.