java.lang.UnsupportedOperationException:Blob不可缓存 [英] java.lang.UnsupportedOperationException: Blobs are not cacheable

查看:252
本文介绍了java.lang.UnsupportedOperationException:Blob不可缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一个对象中添加 java.sql.Blob 字段后,hibernate持久性管理器现在正在抛出 Blob不可缓存异常。

任何想法如何解决这个问题,而不是禁用缓存。我试图让这个领域瞬息万变,但当然没有成功。

顺便说一句,我使用最新的Spring Framework。

解决方案

2个选择。如果您不需要缓存相关的Blob数据,请将其移入未缓存的第二个hibernate对象中。 $


    < b $ b
  1. 如果你想要缓存数据(在这种情况下,我会假定它的大小是有限的),那么你可以使用将数据映射到/从byte [](binaryi相信) - http://www.mkyong.com/hibernate/hibernate -save-image-into-database /


After adding java.sql.Blob field to one of my objects the hibernate persistence manager is now throwing Blobs are not cacheable exception.

Any idea how to solve this other than disabling the cache. I tried making the field transient but of course with no success.

BTW I use the latest Spring Framework.

解决方案

You have 2 choices.

  1. if you don't need the relevant blob data cached, move it into a secondary hibernate object which is not cached
  2. if you do want the data cached (in which case i would assume it has a limited size), then you can use the hibernate type which maps the data to/from a byte[] ("binary" i believe) - http://www.mkyong.com/hibernate/hibernate-save-image-into-database/

这篇关于java.lang.UnsupportedOperationException:Blob不可缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆