List of usage examples for org.hibernate Hibernate initialize
public static void initialize(Object proxy) throws HibernateException
From source file:com.aptech.model.CategoryDao.java
public Category find(Integer id) { Category obj = null;/*w w w . j av a 2s . c o m*/ try { startOperation2(); obj = (Category) session.load(Category.class, id); Hibernate.initialize(obj.getProduct()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return obj; }
From source file:com.aptech.model.OrderDao.java
public Order find(Integer id) { Order obj = null;//from ww w. j av a2 s.c o m try { startOperation2(); obj = (Order) session.load(Order.class, id); Hibernate.initialize(obj.getOrderDetails()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return obj; }
From source file:com.aptech.model.ProductDao.java
public Product find(Integer id) { Product product = null;//from ww w . j a v a2s . c o m try { startOperation2(); product = (Product) session.load(Product.class, id); Hibernate.initialize(product.getProductReview()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return product; }
From source file:com.aptech.model.ProductDao.java
public Product findWithOrder(Integer id) { Product product = null;//w w w . j ava 2 s . c o m try { startOperation2(); product = (Product) session.load(Product.class, id); Hibernate.initialize(product.getOrderDetail()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return product; }
From source file:com.aptech.model.ProductDao.java
public Product getProductWithReviewById(Integer productId) { Product product = null;// w w w .ja va 2s.c o m try { startOperation2(); product = (Product) session.load(Product.class, productId); Hibernate.initialize(product.getProductReview()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return product; }
From source file:com.aptech.model.UserDao.java
public User findWithOrder(Integer id) { User user = null;/*from w w w . j a v a2 s. com*/ try { startOperation2(); user = (User) session.load(User.class, id); Hibernate.initialize(user.getOrder()); tx.commit(); } catch (HibernateException e) { handleException(e); } finally { HibernateFactory.close(session); } return user; }
From source file:com.artivisi.biller.simulator.gateway.pln.service.impl.PlnServiceImpl.java
License:Apache License
@Override public InquiryPostpaidResponse findInquiryPostpaidResponse(String id) { if (StringUtils.isEmpty(id)) return null; InquiryPostpaidResponse i = (InquiryPostpaidResponse) sessionFactory.getCurrentSession() .get(InquiryPostpaidResponse.class, id); if (i != null) { for (InquiryPostpaidResponseDetail detail : i.getDetails()) { Hibernate.initialize(detail.getTagihanPascabayar().getPelanggan()); }//w ww. jav a 2 s . c o m } return i; }
From source file:com.aw.core.dao.DAOHbm.java
License:Open Source License
/** * Tira una excepcion si no existe/*from w w w .j a va2 s . c o m*/ * @param entityClass * @param id * @return */ public <T> T loadAndInitialize(Class<T> entityClass, Serializable id) { Object entity = load(entityClass, id); Hibernate.initialize(entity); return (T) entity; }
From source file:com.aw.core.dao.DAOHbm.java
License:Open Source License
/** * Retorna NULL si no existe//from w w w .ja v a 2 s .c o m * @param aClass * @param pk * @return */ public <T> T getAndInitialize(Class<T> aClass, Serializable pk) { T entity = get(aClass, pk); if (entity != null) Hibernate.initialize(entity); return entity; }
From source file:com.base.DAO.UserDAO.java
public static User findByUserName(String userName) { List<User> lst = null;//from www .j a v a 2 s. co m Session session = HibernateUtil.getSessionFactory().openSession(); lst = session.createQuery("FROM User where username=?").setParameter(0, userName).list(); if (!lst.isEmpty()) { Hibernate.initialize(lst.get(0).getUserRoleses()); } session.close(); if (!lst.isEmpty()) { return lst.get(0); } else { return null; } }