Tôi đã nhận lỗi sauTại sao bản đồ JPA/hibernate không thể thành kiểu blob của MySQL?
Caused by: org.hibernate.HibernateException: Wrong column type in TestTable for column PAYLOAD. Found: blob, expected: tinyblob
at org.hibernate.mapping.Table.validateColumns(Table.java:284)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1174)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:387)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:883)
... 60 more
Cột ngủ đông đang phàn nàn về được khai báo là
private byte[] messagePayload;
@Column(name="PAYLOAD")
public byte[] getMessagePayload() {
return messagePayload;
}
public void setMessagePayload(byte[] messagePayload) {
this.messagePayload = messagePayload;
}
Bảng trong bảng MySQL được khai báo là một kiểu BLOB. Tại sao doesnt Hibernate muốn bản đồ với nó và tại sao nó nhấn mạnh rằng tôi sử dụng TINYBLOB?
Cảm ơn
'columnDefinition' là không di động, sau đó là tiêu chuẩn. 'type' có sẵn trong chế độ ngủ đông trong khi nó không có trong JPA. –
Tôi đã làm thứ hai với EclipseLink và MySQL và có thể xác minh rằng nó hoạt động như mong đợi. –
Tôi đã thêm nhận xét để biết thêm thông tin cho câu trả lời vì OP đã đề cập đến các thẻ JPA/Hibernate, không phải về hoạt động của nó. –