Tipo e tamanhos do campos do banco de dados MySQL Este item é parte dos tópicos sobre MySQL: Confira. Veja a tabela: [table] Tipo Uso Tamanho TINYINT A very small integer The signed range is –128 to 127. The unsigned range is 0 to 255. SMALLINT A small integer The signed range is –32768 to 32767. The unsigned range is 0 to 65535 MEDIUMINT A medium-size integer The signed range is –8388608 to 8388607. The unsigned range is 0 to 16777215 INT or INTEGER A normal-size integer The signed range is –2147483648 to 2147483647. The unsigned range is 0 to 4294967295 BIGINT A large integer The signed range is –9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615 FLOAT A small (single-precision) floating-point number. Cannot be unsigned Ranges are –3.402823466E+38 to –1.175494351E-38, 0 and 1.175494351E-38 to 3.402823466E+38. If the number of Decimals is not set or <= 24 it is a single-precision floating point number DOUBLE, DOUBLE PRECISION, REAL A normal-size (double-precision) floating-point number. Cannot be unsigned Ranges are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0 and 2.2250738585072014E-308 to 1.7976931348623157E+308. If the number of Decimals is not set or 25 <= Decimals <= 53 stands for a double-precision floating point number DECIMAL, NUMERIC An unpacked floating-point number. Cannot be unsigned Behaves like a CHAR column: “unpacked” means the number is stored as a string, using one character for each digit of the value. The decimal point, and, for negative numbers, the ‘–‘ sign is not counted in Length. If Decimals is 0, values will have no decimal point or fractional part. The maximum range of DECIMAL values is the same as for DOUBLE, but the actual range for a given DECIMAL column may be constrained by the choice of Length and Decimals. If Decimals is left...
Usar constraint Default do SQL via Hibernate...
Escrito por Cesar Barbosa
Para setar a constraint Default (SQL) no banco de dados, usando Hibernate use o atributo columnDefinition: [cc lang=”java”] @Column(name=”tx_descricao”, columnDefinition=”varchar(255) null default ‘…'”) private String descricao; @Column(name=”tx_razao_social”, columnDefinition=”varchar(255) null default ‘…'”) private String razaoSocial; @Column(name=”nm_cnpj”, columnDefinition=”varchar(18) null default ‘00.000.000/0000-00′”) private String cnpj; [/cc] Veja como ficou no Banco de dados: Um grande abraço e muito sucesso! Se gostou deixei um...
Recent Comments