I got the following error
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
The column hibernate is complaining about is declared as
private byte[] messagePayload;
@Column(name="PAYLOAD")
public byte[] getMessagePayload() {
return messagePayload;
}
public void setMessagePayload(byte[] messagePayload) {
this.messagePayload = messagePayload;
}
The table in the MySQL table is declared as a BLOB type. Why doesnt Hibernate want to map to it and why does it insist that i use TINYBLOB?
Thanks
You could try to set explicitly the type blob with columnDefinition attribute. Like this:
Or use the @Lob annotation: