public ValueContainer [ ] getKeyValues ( ClassDescriptor cld , Identity oid , boolean convertToSql ) throws PersistenceBrokerException { FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; ValueContainer [ ] result = new ValueContainer [ pkFields . length ] ; Object [ ] pkValues = oid . getPrimaryKeyValues ( ) ; try { for ( int i = 0 ; i < result . length ; i ++ ) { FieldDescriptor fd = pkFields [ i ] ; Object cv = pkValues [ i ] ; if ( convertToSql ) { // BRJ : apply type and value mapping cv = fd . getFieldConversion ( ) . javaToSql ( cv ) ; } result [ i ] = new ValueContainer ( cv , fd . getJdbcType ( ) ) ; } } catch ( Exception e ) { throw new PersistenceBrokerException ( "Can't generate primary key values for given Identity " + oid , e ) ; } return result ; }
Return key Values of an Identity