Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java @hibernate中的GeneratedValue(策略=标识)在部署时不生成关系(表)_Java_Mysql_Hibernate - Fatal编程技术网

Java @hibernate中的GeneratedValue(策略=标识)在部署时不生成关系(表)

Java @hibernate中的GeneratedValue(策略=标识)在部署时不生成关系(表),java,mysql,hibernate,Java,Mysql,Hibernate,我的代码中包含以下内容: @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) private Long id; 而且,我注意到当我有@GeneratedValue时,它不会生成我的MySql表,但是如果没有注释,它会生成相应的表 我应该检查哪些关键点?这是非常棘手的,因为您可能认为您已经正确定义了hibernate的所有属性,并且添加了@GeneratedV

我的代码中包含以下内容:

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Long id;
而且,我注意到当我有@GeneratedValue时,它不会生成我的MySql表,但是如果没有注释,它会生成相应的表


我应该检查哪些关键点?

这是非常棘手的,因为您可能认为您已经正确定义了hibernate的所有属性,并且添加了@GeneratedValue注释,导致了SQL错误。然而,我能够通过更仔细地研究hibernate属性来解决这个问题。在hibernate配置中特别查找以下属性。 属性名称=hibernateProperties>

            hibernate.dialect=${hibernate.dialect}
            hibernate.hbm2ddl.auto=create
对于hibernate.dialogue->您应该有org.hibernate.dialogue.mysql5innodbdialogue 但您可能会看到,它还为MySQL数据库中的->org.hibernate.dialent.sqlserverdialent生成了表,这使您得出结论,您已经正确设置了hibernate属性。 如果任何元数据注释产生语法错误,我强烈建议您检查hibernate属性

谢谢