我尝试使用OrderFactoryUtil创建动态查询来对查询进行排序。这是我的代码:
public List<BirFormNumbers> getAllBirFormNumbers() throws SystemException{
DynamicQuery BirFormNumbersdynamicQuery = DynamicQueryFactoryUtil.forClass(BirFormNumbersImpl.class);
Order order = OrderFactoryUtil.asc("bfnsCode");
BirFormNumbersdynamicQuery.addOrder(order);
return BirFormNumbersLocalServiceUtil.dynamicQuery(BirFormNumbersdynamicQuery);
}
然后我收到了这个错误
{"message":"org.hibernate.QueryException: could not resolve property: bfnsCode of: com.pmti.bir.mrcos.model.impl.BirFormNumbersImpl","exception":"com.liferay.portal.kernel.exception.SystemException"}
03:07:35,530 ERROR [http-bio-8080-exec-4][BasePersistenceImpl:244] Caught unexpected exception org.hibernate.QueryException
我已经看过使用此代码的其他示例,并且它正在为它们工作。我想知道我在哪里得到了错误或者那里发生了什么。感谢
修改
<!-- PK FIELDS -->
<column name="taxtId" type="long" primary="true" id-type="identity"
db-name="TAXT_ID" />
<column name="bfnsCode" type="String" db-name="BFNS_CODE" />
<!-- PK FIELDS -->
<column name="taxtCode" type="String" primary="true" db-name="TAXT_CODE" />
<!-- FIELDS -->
<column name="taxtDesc" type="String" db-name="TAXT_DESC" />
<column name="acctCode" type="String" db-name="ACCT_CODE" />
<column name="createdDate" type="Date" db-name="CREATED_DATE" />
<column name="createdBy" type="String" db-name="CREATED_BY" />
<column name="lastModifiedDate" type="Date" db-name="LAST_MODIFIED_DATE" />
<column name="lastModifiedBy" type="String" db-name="LAST_MODIFIED_BY" />
<column name="taxtStatus" type="String" db-name="TAXT_STATUS" />
<finder return-type="Collection" name="_bfnsCode">
<finder-column name="bfnsCode"></finder-column>
</finder>
</entity>
这是我的service.xml中的声明