我需要从Oracle加载BLOB列(字段名:FOTO)到Java Play Framework。我尝试在我的模型中使用java.sql.Blob(型号名称:ESTUDIANTE),但我收到此错误。
[error] c.a.e.s.t.r.ImmutableMetaFactory - Was unable to use reflection to find a constructor and appropriate getters forimmutable type interface java
.sql.Blob. The errors while looking for the getter methods follow:
[error] c.a.e.s.d.p.DeployCreateProperties - Error with models.Estudiante field:foto
java.lang.RuntimeException: Unable to use reflection to build ImmutableMeta for interface java.sql.Blob. Associated Errors trying to find a construct
or and getter methods have been logged
at com.avaje.ebeaninternal.server.type.reflect.ImmutableMetaFactory.createImmutableMeta(ImmutableMetaFactory.java:53) ~[avaje-ebeanorm.jar:na]
at com.avaje.ebeaninternal.server.type.DefaultTypeManager.recursiveCreateScalarTypes(DefaultTypeManager.java:205) ~[avaje-ebeanorm.jar:na]
at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProp(DeployCreateProperties.java:321) [avaje-ebeanorm.jar:na]
at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProp(DeployCreateProperties.java:341) [avaje-ebeanorm.jar:na]
at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProperties(DeployCreateProperties.java:128) [avaje-ebeanorm.jar:na
]
at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProperties(DeployCreateProperties.java:54) [avaje-ebeanorm.jar:na]
我做错了吗?是否有另一种java数据类型来处理blob?
答案 0 :(得分:2)
您也可以使用javax.persistence.Lob;
@Lob
//Use basic annotation only if you need to LAZY load.
@Basic(fetch = LAZY)
public byte[] data;
默认情况下,java原语提供@Basic(fetch = EAGER),因此在这种情况下{@ 3}}注释@Basic是可选的。