首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

fetch 与 find 的差别

2013-11-14 
fetch 与 find 的区别liferay中 findxxxx 与fetchxxx 方法区别在于数据不存在时前者抛出异常后者返回Null?

fetch 与 find 的区别

liferay中 findxxxx 与fetchxxx 方法区别在于数据不存在时前者抛出异常后者返回Null

?

fetchByPrimaryKey

?

/**

* Returns the product with the primary key or returns <code>null</code> if it could not be found.

*

* @param productId the primary key of the product

* @return the product, or <code>null</code> if a product with the primary key could not be found

* @throws SystemException if a system exception occurred

*/

public Product fetchByPrimaryKey(long productId) throws SystemException?

?

-------------------------------------------------------

findByPrimaryKey

?

/**

* Returns the product with the primary key or throws a {@link com.bluegrid.portlet.product.NoSuchProductException} if it could not be found.

*

* @param productId the primary key of the product

* @return the product

* @throws com.bluegrid.portlet.product.NoSuchProductException if a product with the primary key could not be found

* @throws SystemException if a system exception occurred

*/

public Product findByPrimaryKey(long productId)

throws NoSuchProductException, SystemException {

热点排行