Hibernate / JPA:无法对JDBC目标执行模式管理

时间:2019-06-07 11:01:48

标签: mysql hibernate spring-data-jpa

完全错误是“无法对JDBC目标执行架构管理[创建表DocumentValidation(id bigint不为null的auto_increment,键varchar(255),值varchar(255),documentDetail_id bigint,主键(id)))

使用者:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:SQL语法错误;检查与您的MySQL服务器版本相对应的手册,以获取正确的语法,以在'varchar(255),值varchar(255),documentDetail_id bigint,主键(id))附近使用

实体

@Entity
public class DocumentDetail {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;


//no cascade, a connectionManager save/update cant save/update a  a credential
//unidirectional mapping,
@OneToOne
@JoinColumn(name= "credential_id")
private Credential credential;

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "documentDetail_id")
private List<DocumentValidation> documentValidationList;

public enum DocumentLocationType {
    Confluence, DocumentCentral, FileShare, OneDrive, SharePoint
};

@Enumerated(EnumType.STRING)
private DocumentLocationType locationType;

private String locationUrl;

1 个答案:

答案 0 :(得分:1)

该错误涉及您的DocumentValidation实体:

Unable to execute schema management to JDBC target [create table DocumentValidation (id bigint not null auto_increment, key varchar(255), value varchar(255), documentDetail_id bigint, primary key (id))]

请查看您的专栏: 密钥varchar(255)

关键字单词不能用于列名-这会导致语法错误。