protected String getUniqueString ( FieldDescriptor field ) throws SequenceManagerException { ResultSetAndStatement rsStmt = null ; String returnValue = null ; try { rsStmt = getBrokerForClass ( ) . serviceJdbcAccess ( ) . executeSQL ( "select newid()" , field . getClassDescriptor ( ) , Query . NOT_SCROLLABLE ) ; if ( rsStmt . m_rs . next ( ) ) { returnValue = rsStmt . m_rs . getString ( 1 ) ; } else { LoggerFactory . getDefaultLogger ( ) . error ( this . getClass ( ) + ": Can't lookup new oid for field " + field ) ; } } catch ( PersistenceBrokerException e ) { throw new SequenceManagerException ( e ) ; } catch ( SQLException e ) { throw new SequenceManagerException ( e ) ; } finally { // close the used resources if ( rsStmt != null ) rsStmt . close ( ) ; } return returnValue ; }
returns a unique String for given field . the returned uid is unique accross all tables .