我的数据库视图的hbm文件,所有列都是复合键
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false">
<class name="com.sample.dataobject.MyView"
table="MY_VIEW" >
<composite-id>
<key-property name="code" type="string">
<column name="CODE" length="2" />
</key-property>
<key-property name="Id" type="string">
<column name="ID" length="14" />
</key-property>
<key-property name="Desc" type="string">
<column name="DESC" length="256" />
</key-property>
<key-property name="TypeCode" type="string">
<column name="TYPE_CODE" length="2" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
在上面的视图中,列DESC
可以是空值。
我已根据CODE
和ID
Criteria c = getSession().createCriteria(MyView.class);
c.add(Restrictions.eq("code", 'US'));
c.add(Restrictions.eq("Id", '12'));
List<MyView> annuityServices= c.list();
视图中有2行满足这些条件,但返回的列表为[null,null]
此外,当我使用记录器检查查询和值时,它返回2行,但在DESC列处断开null
2017-06-07 17:08:19 TRACE BasicExtractor:78 - extracted value ([CODE_1_390_0_] : [VARCHAR]) - [US]
2017-06-07 17:08:19 TRACE BasicExtractor:78 - extracted value ([ID_2_390_0_] : [VARCHAR]) - [12]
2017-06-07 17:08:19 TRACE BasicExtractor:68 - extracted value ([DESC_9_390_0_] : [VARCHAR]) - [null]
2017-06-07 17:08:19 TRACE BasicExtractor:78 - extracted value ([CODE_1_390_0_] : [VARCHAR]) - [US]
2017-06-07 17:08:19 TRACE BasicExtractor:78 - extracted value ([ID_2_390_0_] : [VARCHAR]) - [12]
2017-06-07 17:08:19 TRACE BasicExtractor:68 - extracted value ([DESC_9_390_0_] : [VARCHAR]) - [null]
当遇到null
值时,是否存在错误或标准API中断?
由于