MySQL | type-mapping und EntityGeneratorCustomizer | JAVA Beispiel |
---|---|---|
decimal(M,D) [UNSIGNED] [ZEROFILLED] A packed “exact” fixed-point number.
and point (the scale). The decimal point and (for negative numbers) the “ counted in point or fractional part. The maximum number of digits ( number of supported decimals ( omitted, the default is 0. If default is 10.
All basic calculations ( DECIMAL columns are done with a precision of 65 digits. | <sql-type jdbc-type="DECIMAL" hibernate-type="java.math.BigDecimal"></sql-type> visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"DECIMAL"},new String[]{"java.math.BigDecimal"},"decimal")); | private BigDecimal decimaltest; @Column(name = "DECIMALTEST", nullable = false, precision = 10, scale = 0, columnDefinition = "decimal") public BigDecimal getDecimaltest() { return this.decimaltest; } private Double decimaltest; @Column(name = "DECIMALTEST", nullable = false, precision = 10, scale = 0, columnDefinition = "decimal") public Double getDecimaltest() { return this.decimaltest; } |
year A year in four-digit format. MySQL displays YEAR values in assignment of values to YEAR columns using either strings or numbers. Values display as
| <sql-type jdbc-type="YEAR" hibernate-type="java.lang.String"></sql-type> visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"YEAR"},new String[]{"java.lang.String"},"year")); | private String yeartest; @Column(name = "YEARTEST", nullable = false, length = 0, columnDefinition = "year") public String getYeartest() { return this.yeartest; } |
serial
| - - | private Long serialtest; @GeneratedValue(strategy = IDENTITY) @Column(name = "SERIALTEST", unique = true, nullable = false) public Long getSerialtest() { return this.serialtest; } |
int(M) [UNSIGNED] [ZEROFILLED] A normal-size integer. The signed range is The unsigned range is | <sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Integer"> </sql-type> - | private int inttest; @Column(name = "INTTEST", nullable = false) public int getInttest() { return this.inttest; } |
varchar Values in strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a size (65,535 bytes, which is shared among all columns) and the character set used. | - - | private String varchartest; @Column(name = "VARCHARTEST", nullable = false, length = 10) public String getVarchartest() { return this.varchartest; } |
text A TEXT column with a maximum length of 65,535 (216 − 1) characters. The effective maximum length is less if the value contains multibyte characters. Each TEXT value is stored using a 2-byte length prefix that indicates the number of bytes in the value. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"TEXT"},new String[]{"java.lang.String"},"text")); | private String texttest; @Column(name = "TEXTTEST", nullable = false, length = 65535, columnDefinition = "text") public String getTexttest() { return this.texttest; } |
date A date. The supported range is displays DATE values in but permits assignment of values to DATE columns using either strings or numbers. | - - | private Date datetest; @Temporal(TemporalType.DATE) @Column(name = "DATETEST", nullable = false, length = 10) public Date getDatetest() { return this.datetest; } |
tinyint(M) [UNSIGNED] [ZEROFILLED] A very small integer. The signed range is | <sql-type jdbc-type="TINYINT" hibernate-type="java.lang.Short"> </sql-type> visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"TINYINT","TINYINT UNSIGNED"}, new String[]{"java.lang.Short","short"},"tinyint")); | private short tinyinttest; @Column(name = "TINYINTTEST", nullable = false, columnDefinition = "tinyint") public short getTinyinttest() { return this.tinyinttest; } |
smallint(M) [UNSIGNED] [ZEROFILLED] A small integer. The signed range is | - - | private short smallinttest; @Column(name = "SMALLINTTEST", nullable = false) public short getSmallinttest() { return this.smallinttest; } |
mediumint(M) [UNSIGNED] [ZEROFILLED] A medium-sized integer. The signed range is to | - - | private int mediuminttest; @Column(name = "MEDIUMINTTEST", nullable = false) public int getMediuminttest() { return this.mediuminttest; } |
bigint(M) [UNSIGNED] [ZEROFILLED] A large integer. The signed range is to range is | - - | private long biginttest; @Column(name = "BIGINTTEST", nullable = false) public long getBiginttest() { return this.biginttest; } |
float(M,D) [UNSIGNED] [ZEROFILLED] A small (single-precision) floating-point number. Permissible values are
to limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.
number of digits following the decimal point. If the limits permitted by the hardware. A single-precision floating-point number is accurate to approximately 7 decimal places.
| - - | private float floattest; @Column(name = "FLOATTEST", nullable = false, precision = 12, scale = 0) public float getFloattest() { return this.floattest; } |
double(M,D) [UNSIGNED] [ZEROFILLED] A normal-size (double-precision) floating-point number. Permissible values are
These are the theoretical limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.
following the decimal point. If stored to the limits permitted by the hardware. A double-precision floating-point number is accurate to approximately 15 decimal places.
| - - | private double doubletest; @Column(name = "DOUBLETEST", nullable = false, precision = 22, scale = 0) public double getDoubletest() { return this.doubletest; } |
real(M,D) [UNSIGNED] [ZEROFILLED] This type is a synonym for DOUBLE. Exception: If the REAL_AS_FLOAT SQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE. | - - | private double realtest; @Column(name = "REALTEST", nullable = false, precision = 22, scale = 0) public double getRealtest() { return this.realtest; } private Float realtest; @Column(name = "REALTEST", nullable = false, precision = 22, scale = 0) public Float getRealtest() { return this.realtest; } |
bit(M) A bit-field type. value, from 1 to 64. The default is 1 if | - - | private boolean bittest; @Column(name = "BITTEST", nullable = false) public boolean isBittest() { return this.bittest; } |
boolean These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true. | - - | private boolean booleantest; @Column(name = "BOOLEANTEST", nullable = false) public boolean isBooleantest() { return this.booleantest; } |
datetime(fsp) A date and time combination. The supported range is
DATETIME values in format, but permits assignment of values to DATETIME columns using either strings or numbers. An optional given to specify fractional seconds precision. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. | - - | private Date datetimetest; @Temporal(TemporalType.TIMESTAMP) @Column(name = "DATETIMETEST", nullable = false, length = 19) public Date getDatetimetest() { return this.datetimetest; } |
timestamp(fsp) A timestamp. The range is
are stored as the number of seconds since the epoch ( represent the value that is equivalent to 0 seconds from the epoch and the value 0 is reserved for representing
| - - | private Date timestamptest; @Temporal(TemporalType.TIMESTAMP) @Column(name = "TIMESTAMPTEST", nullable = false, length = 19) public Date getTimestamptest() { return this.timestamptest; } |
time(fsp) A time. The range is
of values to TIME columns using either strings or numbers. An optional given to specify fractional seconds precision. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. | - - | private Date timetest; @Temporal(TemporalType.TIME) @Column(name = "TIMETEST", nullable = false, length = 8) public Date getTimetest() { return this.timetest; } |
char(M) Values in CHAR columns are fixed-lenght strings. The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"CHAR"},new String[]{"java.lang.String"},"char")); | private String chartest; @Column(name = "CHARTEST", nullable = false, length = 10, columnDefinition = "char") public String getChartest() { return this.chartest; } |
tinytext [CHARACTER SET charset_name] [COLLATE collation_name] A TEXT column with a maximum length of 255 (28 − 1) characters. The effective maximum length is less if the value contains multibyte characters. Each TINYTEXT value is stored using a 1-byte length prefix that indicates the number of bytes in the value. | - - | private String tinytexttest; @Column(name = "TINYTEXTTEST", nullable = false) public String getTinytexttest() { return this.tinytexttest; } |
mediumtext [CHARACTER SET charset_name] [COLLATE collation_name] A TEXT column with a maximum length of 16,777,215 (224 − 1) characters. The effective maximum length is less if the value contains multibyte characters. Each MEDIUMTEXT value is stored using a 3-byte length prefix that indicates the number of bytes in the value. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"MEDIUMTEXT"},new String[]{"java.lang.String"},"mediumtext")); | private String mediumtexttest; @Column(name = "MEDIUMTEXTTEST", nullable = false, length = 16777215, columnDefinition = "mediumtext") public String getMediumtexttest() { return this.mediumtexttest; } |
longtext [CHARACTER SET charset_name] [COLLATE collation_name] A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 − 1) characters. The effective maximum length is less if the value contains multibyte characters. The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGTEXT value is stored using a 4-byte length prefix that indicates the number of bytes in the value. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"LONGTEXT"},new String[]{"java.lang.String"},"longtext")); | private String longtexttest; @Column(name = "LONGTEXTTEST", nullable = false, columnDefinition = "longtext") public String getLongtexttest() { return this.longtexttest; } |
binary(M) The BINARY type is similar to the CHAR type, but stores binary byte strings rather than nonbinary character strings. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"BINARY"},new String[]{"byte[]"},"binary")); | private byte[] binarytest; @Column(name = "BINARYTEST", nullable = false, columnDefinition = "binary") public byte[] getBinarytest() { return this.binarytest; } |
varbinary(M) The VARBINARY type is similar to the VARCHAR type, but stores binary byte strings rather than nonbinary character strings. length in bytes. | - - | private byte[] varbinarytest; @Column(name = "VARBINARYTEST", nullable = false) public byte[] getVarbinarytest() { return this.varbinarytest; } |
tinyblob A BLOB column with a maximum length of 255 (28 − 1) bytes. Each TINYBLOB value is stored using a 1-byte length prefix that indicates the number of bytes in the value. | - - | private byte[] tinyblobtest; @Column(name = "TINYBLOBTEST", nullable = false) public byte[] getTinyblobtest() { return this.tinyblobtest; } |
mediumblob A BLOB column with a maximum length of 16,777,215 (224 − 1) bytes. Each MEDIUMBLOB value is stored using a 3-byte length prefix that indicates the number of bytes in the value. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"MEDIUMBLOB"},new String[]{"byte[]"},"mediumblob")); | private byte[] mediumblobtest; @Column(name = "MEDIUMBLOBTEST", nullable = false, columnDefinition = "mediumblob") public byte[] getMediumblobtest() { return this.mediumblobtest; } |
blob(M) A BLOB column with a maximum length of 65,535 (216 − 1) bytes. Each BLOB value is stored using a 2-byte length prefix that indicates the number of bytes in the value. An optional length If this is done, MySQL creates the column as the smallest BLOB ype large enough to hold values | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"BLOB"},new String[]{"byte[]"},"blob")); | private byte[] blobtest; @Column(name = "BLOBTEST", nullable = false, columnDefinition = "blob") public byte[] getBlobtest() { return this.blobtest; } |
longblob A BLOB column with a maximum length of 4,294,967,295 or 4GB (232 − 1) bytes. The effective maximum length of LONGBLOB columns depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGBLOB value is stored using a 4-byte length prefix that indicates the number of bytes in the value. | - visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix( new String[]{"LONGBLOB"},new String[]{"byte[]"},"longblob")); | private byte[] longblobtest; @Column(name = "LONGBLOBTEST", nullable = false, columnDefinition = "longblob") public byte[] getLongblobtest() { return this.longblobtest; } |
General
Content
Integrations