如何在游戏模型中表示 oracle blob

how to represent oracle blob in play model

我需要将 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; 

默认情况下,@Basic(fetch=EAGER) 在 java 基元上提供,因此在这种情况下注释 @Basic 是可选的 documentation.