org.hibernate.mappingException:没有 JDBC 类型的方言映射:-4
我无法使用包含 byte[] 类型且长度大于 tinyblob 的实体调用 manager.find(entity)
方法。 如果我像这样定义我的实体变量:
private byte[] data;
或像这样:
@Column(length=200)
private byte[] data;
我没有任何问题,但 hibernate 将列的类型设置为tinyblob,对于我的目的来说太小了。
因此,如果我尝试以这种方式增加维度:
@Column(length=200)
private byte[] data;
或者甚至以这种方式:
@Lob
private byte[] data;
我得到此异常org.hibernate.mappingException:没有 JDBC 类型的方言映射:-4
。我尝试在 persistence.xml 中设置各种方言,但总是遇到同样的问题:( 当我调用manager.find方法时,在运行时抛出异常,当我启动服务器时,该列是BLOB/MEDIUMBLOB/LONGBLOB,因为它应该是
谢谢!
I am not able to call manager.find(entity)
method with an entity containing a type that is a byte[] and has a lenght greater than a tinyblob.
If i define my entity variable like this:
private byte[] data;
or like this:
@Column(length=200)
private byte[] data;
I dont' have any problems, but hibernate set the type of the column as tinyblob, too small for my purposes.
So if i try to Increase the dimension in this way:
@Column(length=200)
private byte[] data;
or even in this way:
@Lob
private byte[] data;
i get this exception org.hibernate.mappingexception: No Dialect mapping for JDBC type: -4
. I tried to set various dialects in my persistence.xml but i get always the same problem :(
The exception is thrown at runtime when i call manager.find
method, when i start the server the column is a BLOB/MEDIUMBLOB/LONGBLOB as it was supposed to be
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现bug,在调用createNativeQuery时,在manager.find方法之前抛出异常。我必须添加 addScalar("data", Hibernate.BLOB)
Found the bug, the exception was thrown before the method manager.find, during the calling of createNativeQuery. i had to add addScalar("data", Hibernate.BLOB)