當前位置: 首頁>>代碼示例>>Java>>正文


Java HibernateObjectRetrievalFailureException類代碼示例

本文整理匯總了Java中org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException的典型用法代碼示例。如果您正苦於以下問題:Java HibernateObjectRetrievalFailureException類的具體用法?Java HibernateObjectRetrievalFailureException怎麽用?Java HibernateObjectRetrievalFailureException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HibernateObjectRetrievalFailureException類屬於org.springframework.orm.hibernate3包,在下文中一共展示了HibernateObjectRetrievalFailureException類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: load

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/**
 * @param id
 *            Set the id
 * @param fetch
 *            Set the fetch profile (can be null)
 * @return the loaded object
 */
public T load(final Long id, final String fetch) {

	Criteria criteria = getSession().createCriteria(type).add(
			Restrictions.idEq(id));

	enableProfilePreQuery(criteria, fetch);

	T t = (T) criteria.uniqueResult();

	if (t == null) {
		throw new HibernateObjectRetrievalFailureException(
				new UnresolvableObjectException(id,
						"Object could not be resolved"));
	}
	enableProfilePostQuery(t, fetch);
	return t;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:25,代碼來源:DaoImpl.java

示例2: handleObjectNotFoundException

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
@ExceptionHandler(HibernateObjectRetrievalFailureException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public ModelAndView handleObjectNotFoundException(HibernateObjectRetrievalFailureException orfe) {
	ModelAndView modelAndView = new ModelAndView("resourceNotFound");
	modelAndView.addObject("exception", orfe);
	return modelAndView;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:8,代碼來源:GenericController.java

示例3: getPostById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/**
 * Retrieve a post by ID.
 * <p>
 * @param post The post to retrieve.
 */
   public Post getPostById(int post)
{
	try
	{
		return (Post) getHibernateTemplate().get(Post.class, new Integer(post));
	}
	catch (HibernateObjectRetrievalFailureException e)
	{
		return null;
	}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:17,代碼來源:HibPostManager.java

示例4: getBoardById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/** Retrieve a board by ID.
 * <p>
 * @param board The board to retrieve.
 */
   public Board getBoardById(int board)
{
	try
	{
		return (Board) getHibernateTemplate().get(Board.class, new Integer(board));
	}
	catch (HibernateObjectRetrievalFailureException e)
	{
		return null;
	}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:16,代碼來源:HibBoardManager.java

示例5: getUserById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/**
 * Get a user by id.
 * <p>
 * @param id The id to use to find the user.
 * @return The user with the given id, or null if none. 
 */
   public User getUserById(int id)
{
	try
	{
		return (User) getHibernateTemplate().get(User.class, new Integer(id));
	}
	catch (HibernateObjectRetrievalFailureException e)
	{
		return null;
	}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:18,代碼來源:HibUserManager.java

示例6: getForumById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/** Retrieve a forum by ID.
* <p>
* @param forum The forum to retrieve.
*/
  public Forum getForumById(int forum)
{
	try
		{
			return (Forum) getHibernateTemplate().get(Forum.class, new Integer(forum));
		}
	catch (HibernateObjectRetrievalFailureException e)
		{
			return null;
		}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:16,代碼來源:HibForumManager.java

示例7: getCategoryById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/** Retrieve a category by ID.
* <p>
* @param category The category to retrieve.
*/
  public Category getCategoryById(int category)
{
	try
		{
			return (Category) getHibernateTemplate().get(Category.class, new Integer(category));
		}
	catch (HibernateObjectRetrievalFailureException e)
		{
			return null;
		}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:16,代碼來源:HibCategoryManager.java

示例8: retrieveObjectById

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException; //導入依賴的package包/類
/**
 * Convenience method for retrieving an arbitrary class by ID. Casting
 * must be performed by the caller.
 * <p>
 * @param id Unique primary key ID for object to retrieve.
 * @param objClass Class of object to retrieve.
 * @return Object if found, null otherwise.
 */
protected Object retrieveObjectById(int id, Class objClass)
{
	try
	{
		return getHibernateTemplate().get(objClass, new Integer(id));
	}
	catch (HibernateObjectRetrievalFailureException e)
	{
		return null;
	}
}
 
開發者ID:iwethey,項目名稱:iwethey,代碼行數:20,代碼來源:HibernateSupportExtensions.java


注:本文中的org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。