private byte [ ] idValueInByteArr ( ) { Object entity = results . get ( results . size ( ) - 1 ) ; Object id = PropertyAccessorHelper . getId ( entity , entityMetadata ) ; String idName = ( ( AbstractAttribute ) entityMetadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ; Class idClazz = ( ( AbstractAttribute ) entityMetadata . getIdAttribute ( ) ) . getBindableJavaType ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; EmbeddableType keyObj = null ; ByteBuffer bytes = null ; // if the key attribute is composite if ( metaModel . isEmbeddable ( entityMetadata . getIdAttribute ( ) . getBindableJavaType ( ) ) ) { keyObj = metaModel . embeddable ( entityMetadata . getIdAttribute ( ) . getBindableJavaType ( ) ) ; Field embeddedField = getPartitionKeyField ( ) ; Attribute partitionKey = keyObj . getAttribute ( embeddedField . getName ( ) ) ; Object partitionKeyValue = PropertyAccessorHelper . getObject ( id , ( Field ) partitionKey . getJavaMember ( ) ) ; bytes = CassandraUtilities . toBytes ( partitionKeyValue , ( Field ) partitionKey . getJavaMember ( ) ) ; } else { bytes = query . getBytesValue ( idName , entityMetadata , id ) ; } return bytes . array ( ) ; }
Id value in byte arr .