JPA auto-ddl , setting Long value length not work

Viewed 54
@Data
@Entity
@Table(name = "test_jpa")
public class TestEntity implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id",length = 19)
private Long id;

@Column(name = "length",precision = 10)
private Long length;

@Column(name = "test", length = 19)
private String test;
}

Log print:

Hibernate: create table test_jpa (id bigint not null, length bigint, test varchar(19), primary key (id)) engine=InnoDB

The length of Long value ,do not work.Also I tried @Size and @Length, same problem.

JPA version:2.6.7 Mysql

Thank you M. Deinum. I get it, Numeric types no need to set length,They have fixed range.

0 Answers
Related