How Do I Delete a Business Entity Instance?

There are a number of ways to delete entities.

  1. Delete an instance that you have a reference to:
                   person.delete();
                
  2. Delete an instance where you have only its Id:
                   delete(personId);
                
  3. Delete the results of a query
                   Query query = createQuery("from Person person where exists ( "
                       + " from PersonName as perName where person = perName.id.person and "
                       + "perName.isPrimaryName = :systemBool and perName.entityName "
                       + "like :name)");
                    query.bindLikableString("name", "ABC", 64);
                    query.bindBoolean("systemBool", com.splwg.base.api.datatypes.Bool.TRUE);
                   
                    long rowsDeleted = query.delete();