JPA--Caused by: javax.persistence.PersistenceException: [PersistenceUnit: mysqlJPA] Unable to configure EntityManagerFactory

出现此错误的原因是因为在Supplier类的id上添加了@GeneratedValue(strategy = GenerationType.AUTO, generator = "sequenceGenerator"),

而sequenceGenerator不存在。

package pr.cgl.model;

import javax.annotation.Generated;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
* Created by xiaotuerguaiguai on 15/11/30.
*/
@Entity
@Table(name = "xx_supplier")
public class Supplier {

private Integer id;

private String name;

private List<Product> productList = new ArrayList<Product>();

@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "sequenceGenerator")
public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Transient
public List<Product> getProductList() {
return productList;
}

public void setProductList(List<Product> productList) {
this.productList = productList;
}
}
posted @ 2015-12-14 23:32  cglworkBook  阅读(1349)  评论(0编辑  收藏  举报