如何按照Hibernate中模型中指定的顺序组织数据库列?

时间:2018-09-18 08:36:16

标签: mysql hibernate spring-boot

我在Spring Boot中使用以下字段创建了一个模型:

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private int id;

@Size(max = 50)
@Column(name = "title")
private String title;

@Column(name = "coinmarketcap_slug")
private String coinmarketcapSlug;

@Column(name = "coinmarketcap_id")
private int coinmarketcapId;

@Column(name = "symbol")
private String symbol;

@Column(name = "twitter_screen_name")
private String twitterScreenName;

@Column(name = "subreddit")
private String subreddit;

@Column(name = "facebook")
private String facebook;

@Column(name = "youtube")
private String youtube;

@Column(name = "linkedin")
private String linkedin;

@Column(name = "instagram")
private String instagram;

@Column(name = "medium")
private String medium;

@Column(name = "github")
private String github;

@Column(name = "stackexchange")
private String stackexchange;

@Column(name = "meetup")
private String meetup;

@Column(name = "gitter")
private String gitter;

@Column(name = "logo")
private String logo;

我激活了此选项,以允许Hibernate将数据库表与实体字段同步:

  

spring.jpa.hibernate.ddl-auto = update

这是结果:

enter image description here

不幸的是,这些列的组织顺序与我在模型中指定的顺序不同。

我以前在PHP上使用Doctrine,默认情况下会自动执行。

是否可以使用Hibernate做到这一点?

0 个答案:

没有答案