bad*_*son 5 java hibernate hibernate-mapping
我有一个非常简单的对象结构,这给我一个我无法解决的错误。做了大量的搜索,我认为这一定是一个很常见的用例,所以不确定是什么问题。我有以下三个课程:
@Entity
public class Widget {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int idd;
    private Date date;
    private String type;
    private int ownerId;
    @OneToOne(cascade = CascadeType.ALL)
    private Rating rating;
    @OneToMany(cascade = CascadeType.ALL)
    private List<Tag> tagList;
}
@Entity
public class Rating {
public enum ChartType  {RADAR, BAR, LINE, STAR};
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int ratingId;
private String name;
@Enumerated(EnumType.STRING)
private ChartType chartType;
private double normalizedValue;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
private List<RatingComponent> componentList = new ArrayList<>();
public Rating() {
    buildNormalizedValue();
}
}
@Entity
public class RatingComponent {
@Id
@GeneratedValue()
private int compId;
private String name;
private double value;
private double maxValue;
}
在DAO中保存时,出现了我不太了解的错误,例如
2018-07-23 11:43:07,208 WARN o.h.t.s.i.ExceptionHandlerLoggedImpl [main] GenerationTarget encountered exception accepting command : 
Error executing DDL "alter table Rating_RatingComponent drop foreign key FKaudjguwlo1i8tm2jgli5bbnq6" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table Rating_RatingComponent drop foreign key FKaudjguwlo1i8tm2jgli5bbnq6" via JDBC Statement
再往下走
2018-07-23 11:43:07,644 WARN o.h.t.s.i.ExceptionHandlerLoggedImpl [main] GenerationTarget encountered exception accepting command : Error executing DDL "create table RatingComponent (compId integer not null, maxValue double precision not null, name varchar(255), value double precision not null, primary key (compId)) engine=InnoDB" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table RatingComponent (compId integer not null, maxValue double precision not null, name varchar(255), value double precision not null, primary key (compId)) engine=InnoDB" via JDBC Statement
我的配置中有这些属性
    <property name="hibernate.hbm2ddl.auto">create</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property> 
我以为我已经非常仔细地浏览了文档,并且认为这是一个非常简单的对象设计...有关如何解决的任何想法,以及我应该在文档中的何处更仔细地研究以了解根本原因?
谢谢!
替换
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
经过
<property name="hibernate.dialect">org.hibernate.dialect.MySQL8InnoDBDialect</property>
会成功的
| 归档时间: | 
 | 
| 查看次数: | 6481 次 | 
| 最近记录: |