我的列类型有点问题。我有两个站点可以通过REST进行通信。我的问题是我背后有一个数据库,希望使用特定的类型,但无法使它正常工作。
@Entity
@Table(name = "inventory")
public class Inventory implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private int inventoryId;
private Film film;
@Column(name = "film_id", nullable = false)
public Film getFilm() {
return film;
}
public void setFilm(Film film) {
this.film = film;
}
//everything else
电影课
public class Film implements java.io.Serializable {
private int filmId;
//everything else
错误日志:
{"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"sprint-3-gruppe-1-store.war#default\"" => "javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [film_id] in table [inventory]; found [int4 (Types#INTEGER)], but expecting [byte[] (Types#VARBINARY)]"}}
有人知道如何解决此问题吗?我在persistence.xml中有此文件,但是删除它时遇到了其他一些问题。因此,最好的方法是定义一个列类型,但我不知道他的期望。
<property name="hibernate.hbm2ddl.auto" value="validate" />