gpt4 book ai didi

java - 使用hibernate创建新表时如何维护列顺序?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:58:09 24 4
gpt4 key购买 nike

<分区>

这是我注释为实体的 pojo

@Entity
@Table(name = "book", catalog = "book_db")
public class Book {
private Integer bookId;
private String bookName;
private String bookShortDesc;
private String bookDesc;
private String bookAuthor;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "book_id", unique = true, nullable = false)
public Integer getBookId() {
return this.bookId;
}

@Column(name = "book_name", nullable = false, length = 256)
public String getBookName() {
return this.bookName;
}
@Column(name = "book_short_desc", nullable = false, length = 1024)
public String getBookShortDesc() {
return this.bookShortDesc;
}

等等……

上面的实体是使用注释创建的,当我查看 mysql 数据库时,列不是按顺序创建的,我在下面写了,相反,第一列是 book_id,然后是 book_desc,然后是 book_athor,然后是 book_short_desc 然后书名。

我的问题是如何告诉 Hibernate 按照我在 Java 代码中编写的相同顺序创建列??

有注释吗??

问候

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com