@ Override public void delete ( Object entity , Object pKey ) { EntityMetadata entityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entity . getClass ( ) ) ; MetamodelImpl metamodel = ( MetamodelImpl ) KunderaMetadataManager . getMetamodel ( kunderaMetadata , entityMetadata . getPersistenceUnit ( ) ) ; String idColumnName = ( ( AbstractAttribute ) entityMetadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ; Table schemaTable = tableAPI . getTable ( entityMetadata . getTableName ( ) ) ; PrimaryKey key = schemaTable . createPrimaryKey ( ) ; if ( metamodel . isEmbeddable ( entityMetadata . getIdAttribute ( ) . getBindableJavaType ( ) ) ) { EmbeddableType embeddableId = metamodel . embeddable ( entityMetadata . getIdAttribute ( ) . getBindableJavaType ( ) ) ; Set < Attribute > embeddedAttributes = embeddableId . getAttributes ( ) ; for ( Attribute embeddedAttrib : embeddedAttributes ) { String columnName = ( ( AbstractAttribute ) embeddedAttrib ) . getJPAColumnName ( ) ; Object embeddedColumn = PropertyAccessorHelper . getObject ( pKey , ( Field ) embeddedAttrib . getJavaMember ( ) ) ; NoSqlDBUtils . add ( schemaTable . getField ( columnName ) , key , embeddedColumn , columnName ) ; } } else { NoSqlDBUtils . add ( schemaTable . getField ( idColumnName ) , key , pKey , idColumnName ) ; } tableAPI . delete ( key , null , null ) ; KunderaCoreUtils . printQuery ( "Delete data from " + entityMetadata . getTableName ( ) + " for PK " + pKey , showQuery ) ; }
Delete by primary key .