Java 如何在播放模型中表示oracle blob

Java 如何在播放模型中表示oracle blob,java,oracle,playframework-2.2,Java,Oracle,Playframework 2.2,我需要将一个BLOB列(字段名:FOTO)从Oracle加载到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 j

我需要将一个BLOB列(字段名:FOTO)从Oracle加载到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?

您也可以使用javax.persistence.Lob

@Lob
//Use basic annotation only if you need to LAZY load. 
@Basic(fetch = LAZY)
public byte[] data; 

默认情况下,java原语上提供了@Basic(fetch=EAGER),因此在这种情况下注释@Basic是可选的。

感谢您的回复,我不再收到错误,但是
foto
字段总是获取空值,我检查数据库字段是否为空,这可能是什么?您是否使用了fetch=LAZY?如果要获取EAGER,请尝试使用fetch=EAGER