/**
   * @param entity
   * @param user
   * @return
   * @throws org.springframework.dao.DataAccessException
   */
  public void update(I entity, QaUser user) {

    // sanity check
    // sanity check
    Validate.notNull(user, "User cannot be null");
    Validate.notNull(entity, "Object cannot be null");

    // session
    Session session = sessionFactory.getCurrentSession();

    // prepare metadata
    QaMetadata metadata = ((QaMetaObject) entity).getMetadata();
    if (null == metadata) {
      metadata = new QaMetadata();
      metadata.setCreatedDate(new Timestamp(System.currentTimeMillis()));
      metadata.setCreator(user.getId());
      metadata.setState(QaMetaState.ACTIVE);
    }
    metadata.setModifiedDate(new Timestamp(System.currentTimeMillis()));
    metadata.setModifier(user.getId());
    ((QaMetaObject) entity).setMetadata(metadata);

    // update
    session.update(entity);
  }