-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: @Column overrides @Lob?
PostPosted: Sat Aug 13, 2005 7:49 pm 
Newbie

Joined: Sat Aug 13, 2005 7:33 pm
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 8:12 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
biinary is a reserved keyword of MySql

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Column name changed
PostPosted: Sat Aug 13, 2005 8:48 pm 
Newbie

Joined: Sat Aug 13, 2005 7:33 pm
Posts: 5
Changed the column name and works now. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.