Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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 为什么jpa不创建表?_Java_Jpa_Entity - Fatal编程技术网

Java 为什么jpa不创建表?

Java 为什么jpa不创建表?,java,jpa,entity,Java,Jpa,Entity,我的JavaSpring启动项目中有一些类。我对localhost使用jpa和xampp。所有实体类都工作,并为每个@Entity类创建表。但这门课不起作用。为什么? @AllArgsConstructor @NoArgsConstructor @Data @Entity public class Match { @Id private String matchId; @Enumerated private MatchType matchType; } 试试这个

我的JavaSpring启动项目中有一些类。我对localhost使用jpa和xampp。所有实体类都工作,并为每个@Entity类创建表。但这门课不起作用。为什么?

@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
public class Match {
    @Id
    private String matchId;
    @Enumerated
    private MatchType matchType;
}
试试这个:

@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@Table(name = "\"Match"\")
public class Match {
    @Id
    private String matchId;
    @Enumerated
    private MatchType matchType;
}
更一般,如果您设置

hibernate.globally\u quoted\u identifiers=true


每个标识符都会被引用。

这个类和正常工作的类有什么区别?
Match
在MySQL中是一个保留关键字,所以它可能不允许创建该名称的表。我猜Matnh是保留的,并且在属性中选中ddl auto:true创建另一个名为Where的实体,看看它是否有效。我甚至不知道原因是什么。每个带有@Entity标记的类都会在数据库中创建表,但这并不是