- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 Java 实体类中获取表记录,其中一列被定义为 CLOB。当我执行选择查询时,出现以下错误:-
[EclipseLink-3002](Eclipse 持久性服务 - 2.6.2.qualifier):org.eclipse.persistence.exceptions.ConversionException 错误。
下面是详细的代码............
<小时/>在数据库中,我有 CLOB 列。我正在对实体执行选择查询。下面是详细内容。
在数据库表中MSG列被定义为CLOB。
我的实体类如下。
@Entity
@Table( name = "MyTable", schema="TEST" )
@NamedQueries({
@NamedQuery( name = "MyTable.findByChangeKey", query = "SELECT t FROM MyTable t WHERE t.changeKey = :changeKey)
} )
public class MyTable implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic( optional = false )
@Column( name = "ID", nullable = false )
private Integer msgId;
@Basic( optional = false )
@Column( name = "CHANGE_KEY", nullable = false, length = 15 )
private String changeKey;
@Column( name = "MSG")
@Lob
private byte[] msg;
public Tsmtidsm() {
}
public byte[] getMsg() {
if(msg!=null)
{
return (byte[])msg.clone();
}
else
{
return msg;
}
}
public void setMsg( byte[] msg ) {
if(msg!=null)
{
this.msg = (byte[])msg.clone();
}
else
{
this.msg=null;
}
}
public Tsmtidsm( Integer msgId ) {
this.msgId = msgId;
}
public Integer getMsgId() {
return msgId;
}
public void setMsgId( Integer msgId ) {
this.msgId = msgId;
}
public String getChangeKey() {
return changeKey;
}
public void setChangeKey( String changeKey ) {
this.changeKey = changeKey;
}
}
<小时/>
下面是我调用我的选择查询的代码行
Query searchQuery = em.createNamedQuery( "MyTable.findByChangeKey" );
searchQuery.setParameter("changeKey", serialNumber );
List<MyTable> myTable=(List<MyTable>)searchQuery.getResultList();
<小时/>
执行上述代码时出现以下错误。
Caused by: Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.2.qualifier): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [[B@2b2d02e5], of class [class java.lang.String], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[msg-->TEST.MyTable.MSG]] with descriptor [RelationalDescriptor(com.dao.data.MyTable--> [DatabaseTable(TEST.MyTable)])], could not be converted to [class [B].
at org.eclipse.persistence.exceptions.ConversionException.couldNotConvertToByteArray(ConversionException.java:115)
请帮忙,我不确定上面的代码有什么问题,有人可以帮助我吗?提前致谢!!
最佳答案
CLOB 需要是 char[]
而不是 byte[]
..... byte[]
用于 BLOB
关于java - 异常 [EclipseLink-3002](Eclipse 持久性服务 - 2.6.2.qualifier): org. eclipse.persistence.exceptions.ConversionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48862391/
根据这个answer ,下面的代码应该没有错误地编译: #include namespace { struct A { int i; }; volatile A a{}; static_assert
我了解导入 Data.List。 但是 importqualified Data.List 语句中的 qualified 是什么意思? 最佳答案 合格的导入使导入的实体仅以合格的形式可用,例如 imp
我正在尝试创建一个组件,该组件将接受一个特定的 bean (fasterxml ObjectMapper)。 如果有一个名为 qualifiedObjectMapper 的限定 bean,我想使用那个
我一直在编写以下代码来支持对右值的函数调用,而不必 std::move明确地在返回值上。 struct X { X& do_something() & { // some co
我正在尝试使用 GCC 编译器编译以下代码 class Class { public: uInt16 temp; const uInt32 function() const; } inline
我试图理解为什么我的编译器警告我有关此代码: static const char *const _menuMain_Strings_1[] __ATTR_PROGMEM__ = { _menuMai
我正在尝试将 Spring 4.x.x 迁移到 Spring boot,它依赖于外部 spring 2.5 jar 中的类。我已经进行了所有 Autowiring 更改,下面是我的应用程序类 @Spr
我从 eclipse git 中查看了最新的源代码:git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.
我发现许多门户网站都解释了类似的问题。但我想这是独特的情况。我在 spring mvc 应用程序中遇到错误。 org.springframework.beans.factory.Unsatisfied
我有下面的代码: package far.botshop.backend.controller; /** */ import java.util.logging.Logger; import far
我有 3 个数据源,设置如下: @Configuration @Component public class DataSourceConfig { @Bean("foo") @Conf
如何添加限定符来区分这两个 bean?我知道我需要使用 @Qualifier 注释,但我不确定如何将它添加到 bean 中,然后如何引用适当的 bean 创建 Autowiring 对象。 @Conf
@Override @Autowired(required = true) @Qualifier("hibernateCriteriaBuilder") public void setCriteria
我有 Circle 类: public class Circle { @Autowired @Qualifier("pointA") private Point center;
我在 Java Spring 环境中工作,并且在让 @Qualifier 工作时遇到了问题。我们项目的其他部分正在使用 @Inject 获取一个 bean,但我需要同一个 bean 的两个版本,看起来
“qualifier”的含义是什么?“qualifier”和“keyword”之间的区别是什么? 对于C语言中的volatile限定词,我们可以说volatile是一个关键字,那么“qualifier
我有一个简单的宏来设置一些常见的标题和格式: Dim colString(1 To 17, 1 To 2) As String Dim i As Integer colString(1, 1) = "
我正在将 Teradata 转换为 Hive(版本 0.10.0)。 Teradata 查询: QUALIFY ROW_NUMBER() OVER (PARTITION BY ADJSTMNT,SRC
我是在 PHP 中使用命名空间的新手,它们看起来很简单。然而,当我在一个包含类、接口(interface)和闭包的大文件的顶部添加一个命名空间时,代码完全停止工作。显然,某些元素没有正确限定。 例如:
我正在尝试使用属性占位符作为@Qualifier 的属性,如下所示: @Autowired @Qualifier("${beanName}") private MyBean myBean; 但是,这不
我是一名优秀的程序员,十分优秀!