Hi,
I am using hibernate-3.1beta1 and hibernate-annotations-3.1beta4, MySQL 4.0.21, MyISM tables.
The following will generate SQL in which the binary column is seen as some VARCHAR BINARY column. What follows is an SQLException (pasted below).
@NotNull
@Lob(type=LobType.BLOB)
@Column(name="binary")
public Blob getBinaryBlob() {
return Hibernate.createBlob(binary);
}
Renaming the column to binaryBlob in the database and commenting out the @Column annotation fixes it.
It this a bug?
Regards,
Erik.
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [zout.site.content.Image]
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1836)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2253)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:266)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:164)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:167)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:113)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:549)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:156)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:211)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:155)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:106)
at org.hibernate.engine.Cascade.cascade(Cascade.java:246)
at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:305)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:133)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:115)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:60)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:540)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:544)
at zout.site.DbTest.main(DbTest.java:50)
Caused by: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'binary, mimetype, alt, height, width, version) values ('’\0sr
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:930)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1159)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1076)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1061)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1818)
... 21 more
|