/**
  * Sets up the test before its execution, by creating the dao and the transaction.
  *
  * @throws Exception if an unexpected exception occurs.
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   class101BIDao = SampleDaoFactory.getAssociationsClass101BIDao();
   class101BIENDDao = SampleDaoFactory.getAssociationsClass101BIENDDao();
   tx = HibernateUtil.currentSession().beginTransaction();
 }
 /**
  * Delete an element Only id can be used to find which element must be deleted.
  *
  * @param class_1_01_BI Element which will be deleted.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.inheritanceassociations.IClass101BIDao.deleteClass_1_01_BI
  */
 public void deleteClass101BI(Class101BI class101BI) throws DaoException {
   LOG.debug("Delete the entity Class_1_01_BI with id =" + class101BI.getId());
   try {
     Session session = HibernateUtil.currentSession();
     session.delete(class101BI);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
 /**
  * Create a new element
  *
  * @param class_1_01_BI Element to create.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.inheritanceassociations.IClass101BIDao.createClass_1_01_BI
  */
 public void createClass101BI(final Class101BI class101BI) throws DaoException {
   LOG.debug("Create a new Class101BI entity");
   try {
     Session session = HibernateUtil.currentSession();
     session.save(class101BI);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
 /**
  * Delete an element Only id can be used to find which element must be deleted.
  *
  * @param class_01_Many Element which will be deleted.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.associations.IClass01ManyDao.deleteClass_01_Many
  */
 public void deleteClass01Many(Class01Many class01Many) throws DaoException {
   LOG.debug("Delete the entity Class_01_Many with id =" + class01Many.getId());
   try {
     Session session = HibernateUtil.currentSession();
     session.delete(class01Many);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
 /**
  * Delete an element Only id can be used to find which element must be deleted.
  *
  * @param protected Element which will be deleted.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.badpractives.IProtected_Dao.deleteprotected
  */
 public void deleteprotected_(Protected_ protected_) throws DaoException {
   LOG.debug("Delete the entity protected with id =" + protected_.getId());
   try {
     Session session = HibernateUtil.currentSession();
     session.delete(protected_);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
 /**
  * Create a new element
  *
  * @param protected Element to create.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.badpractives.IProtected_Dao.createprotected
  */
 public void createprotected_(final Protected_ protected_) throws DaoException {
   LOG.debug("Create a new protected_ entity");
   try {
     Session session = HibernateUtil.currentSession();
     session.save(protected_);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
 /**
  * Delete an element Only id can be used to find which element must be deleted.
  *
  * @param class_1_1_BI_END_Sub Element which will be deleted.
  * @throws DaoException If an HibernateException occurs.
  * @see
  *     org.obeonetwork.sample.inheritanceassociations.IClass11BIENDSubDao.deleteClass_1_1_BI_END_Sub
  */
 public void deleteClass11BIENDSub(Class11BIENDSub class11BIENDSub) throws DaoException {
   LOG.debug("Delete the entity Class_1_1_BI_END_Sub with id =" + class11BIENDSub.getId());
   try {
     Session session = HibernateUtil.currentSession();
     session.delete(class11BIENDSub);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
  /**
   * Find one entity by its primary key.
   *
   * @param id The PK of the entity
   * @return The entity found.
   * @throws DaoException If an HibernateException occurs.
   * @see org.obeonetwork.sample.inheritanceassociations.IClass101BIDao.findClass_1_01_BIById
   */
  public Class101BI findClass101BIById(String id) throws DaoException {
    LOG.debug("Find one instance of Class_1_01_BI entity by id : " + id);
    try {
      Session session = HibernateUtil.currentSession();
      Criteria criteria = session.createCriteria(Class101BI.class).add(Restrictions.eq("id", id));
      Class101BI result = (Class101BI) criteria.uniqueResult();

      return result;
    } catch (HibernateException e) {
      throw new DaoException(e);
    }
  }
  /**
   * Find one entity by its primary key.
   *
   * @param id The PK of the entity
   * @return The entity found.
   * @throws DaoException If an HibernateException occurs.
   * @see org.obeonetwork.sample.badpractives.IProtected_Dao.findprotectedById
   */
  public Protected_ findprotected_ById(String id) throws DaoException {
    LOG.debug("Find one instance of protected entity by id : " + id);
    try {
      Session session = HibernateUtil.currentSession();
      Criteria criteria = session.createCriteria(Protected_.class).add(Restrictions.eq("id", id));
      Protected_ result = (Protected_) criteria.uniqueResult();

      return result;
    } catch (HibernateException e) {
      throw new DaoException(e);
    }
  }
  /**
   * Find all elements.
   *
   * @return A list with all elements, without any filter.
   * @throws DaoException If an HibernateException occurs.
   * @see org.obeonetwork.sample.inheritanceassociations.IClass101BIDao.findAllClass_1_01_BIs
   */
  public Collection<Class101BI> findAllClass101BIs() throws DaoException {
    LOG.debug("Find all instance of Class_1_01_BI entity");
    try {
      Session session = HibernateUtil.currentSession();
      Criteria criteria = session.createCriteria(Class101BI.class);
      Collection<Class101BI> resultList = criteria.list();

      LOG.debug("Found " + resultList.size() + " instances of Class_1_01_BI entity");
      return resultList;
    } catch (HibernateException e) {
      throw new DaoException(e);
    }
  }
  /**
   * Find all elements.
   *
   * @return A list with all elements, without any filter.
   * @throws DaoException If an HibernateException occurs.
   * @see org.obeonetwork.sample.badpractives.IProtected_Dao.findAllprotecteds
   */
  public Collection<Protected_> findAllprotected_s() throws DaoException {
    LOG.debug("Find all instance of protected entity");
    try {
      Session session = HibernateUtil.currentSession();
      Criteria criteria = session.createCriteria(Protected_.class);
      Collection<Protected_> resultList = criteria.list();

      LOG.debug("Found " + resultList.size() + " instances of protected entity");
      return resultList;
    } catch (HibernateException e) {
      throw new DaoException(e);
    }
  }
예제 #12
0
 /**
  * Cleans up the test after its execution, by commiting the transaction in order for the DB
  * changes to become visible, and closing hibernate's session.
  *
  * @throws Exception if an unexpected exception occurs.
  */
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   tx.commit();
   HibernateUtil.closeSession();
 }
예제 #13
0
 /**
  * Sets up the test before its execution, by creating the dao and the transaction.
  *
  * @throws Exception if an unexpected exception occurs.
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   tABLEDao = SampleDaoFactory.getTABLEDao();
   tx = HibernateUtil.currentSession().beginTransaction();
 }
 /**
  * Sets up the test before its execution, by creating the dao and the transaction.
  *
  * @throws Exception if an unexpected exception occurs.
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   assobidimanytomanyDao = null; // FIXME
   tx = HibernateUtil.currentSession().beginTransaction();
 }