public boolean duplicate(Class<? extends Entity<?>> clazz, Serializable id, String codeName,
      Object codeValue) {
    if (null != codeValue && Strings.isNotEmpty(codeValue.toString())) {
      List<? extends Entity<?>> list = get(clazz, codeName, new Object[] { codeValue });
      if (list != null && !list.isEmpty()) {
        if (id == null) {
          return true;
        } else {
          for (Iterator<? extends Entity<?>> it = list.iterator(); it.hasNext();) {
            Entity<?> info = it.next();
            if (!info.getId().equals(id)) return true;
          }
          return false;
        }
      }
    }
    return false;
  }
public boolean duplicate ( Class < ? extends Entity < ? > > clazz , Serializable id , String codeName , Object codeValue ) { if ( null != codeValue && Strings . isNotEmpty ( codeValue . toString ( ) ) ) { List < ? extends Entity < ? > > list = get ( clazz , codeName , new Object [ ] { codeValue } ) ; if ( list != null && ! list . isEmpty ( ) ) { if ( id == null ) { return true ; } else { for ( Iterator < ? extends Entity < ? > > it = list . iterator ( ) ; it . hasNext ( ) ; ) { Entity < ? > info = it . next ( ) ; if ( ! info . getId ( ) . equals ( id ) ) return true ; } return false ; } } } return false ; }
检查持久化对象是否存在

@param clazz
@param id
@param codeName
@param codeValue
@return boolean(是否存在) 如果entityId为空或者有不一样的entity存在则认为存在。