@Override public long count(EntityMapping em) { return commandFactory().newCountEntityCommand(this, em).execute(); }
@Override public CreateEntityCommand cmdCreateEntity(Class<?> entityClass) { Args.notNull(entityClass,"entity class"); return commandFactory().newCreateEntityCommand(this, entityClass); }
@Override public CreateTableCommand cmdCreateTable(EntityMapping em) { Args.notNull(em, "entity mapping"); return commandFactory().newCreateTableCommand(this, em); }
@Override public DeleteCommand cmdDelete(EntityMapping em, Object id) { return runInWrapperContext(em, (context)->{ return commandFactory().newDeleteCommand(context.getDao(),context.getEntityMapping(), id); }); }
@Override public int deleteAll(EntityMapping em) { Args.notNull(em); return runInWrapperContext(em, (context)->{ return commandFactory().newDeleteAllCommand(context.getDao(),context.getEntityMapping()).execute(); }); }
@Override public boolean exists(String entityName, Object id) throws MappingNotFoundException { return runInWrapperContext(em(entityName), (context)->{ return commandFactory().newCheckEntityExistsCommand(context.getDao(),context.getEntityMapping(), id).execute(); }); }
protected int[] doBatchDelete(EntityMapping em, Object[] ids) { return runInWrapperContext(em, (context)->{ return commandFactory().newBatchDeleteCommand(context.getDao(), context.getEntityMapping(), ids).execute(); }); }
@Override public boolean cascadeDelete(EntityMapping em, Object id) { return runInWrapperContext(em, (context)->{ return commandFactory().newCascadeDeleteCommand(context.getDao(),context.getEntityMapping(), id).execute(); }); }
protected int[] doBatchInsert(EntityMapping em, Object[] records) { return runInWrapperContext(em, (context)->{ return commandFactory().newBatchInsertCommand(context.getDao(), context.getEntityMapping(), records).execute(); }); }
protected int[] doBatchUpdate(EntityMapping em, Object[] records) { return runInWrapperContext(em, (context)->{ return commandFactory().newBatchUpdateCommand(context.getDao(), context.getEntityMapping(), records).execute(); }); }
@Override public int delete(EntityMapping em, Object id) { Args.notNull(em); Args.notNull(id); return runInWrapperContext(em, (context)->{ return commandFactory().newDeleteCommand(context.getDao(),context.getEntityMapping(), id).execute(); }); }
public int deleteAll(Class<?> entityClass) { Args.notNull(entityClass,"entity class"); EntityMapping em = em(entityClass); return runInWrapperContext(em, (context)->{ return commandFactory().newDeleteAllCommand(context.getDao(),context.getEntityMapping()).execute(); }); }
@Override public boolean exists(Class<?> entityClass, Object id) { Args.notNull(entityClass,"entity class"); Args.notNull(id,"id"); return runInWrapperContext(em(entityClass), (context)->{ return commandFactory().newCheckEntityExistsCommand(context.getDao(),context.getEntityMapping(), id).execute(); }); }
@Override public int delete(Class<?> entityClass, Object id) { Args.notNull(entityClass,"entityClass"); Args.notNull(id,"id"); return runInWrapperContext(em(entityClass), (context)->{ return commandFactory().newDeleteCommand(context.getDao(),context.getEntityMapping(),id).execute(); }); }
@Override public int deleteAll(String entityName) { Args.notNull(entityName); EntityMapping em = em(entityName); return runInWrapperContext(em, (context)->{ return commandFactory().newDeleteAllCommand(context.getDao(),context.getEntityMapping()).execute(); }); }
@Override public CreateTableCommand cmdCreateTable(Class<?> entityClass) { Args.notNull(entityClass, "entity class"); return commandFactory().newCreateTableCommand(this, em(entityClass)); }
@Override public long count(String entityName) { return commandFactory().newCountEntityCommand(this, em(entityName)).execute(); }
@Override public int delete(String entityName, Object id) throws MappingNotFoundException { Args.notNull(entityName,"entityName"); Args.notNull(id,"id"); return runInWrapperContext(em(entityName), (context)->{ return commandFactory().newDeleteCommand(context.getDao(),context.getEntityMapping(),id).execute(); }); }
@Override public boolean createTableIfNotExists(Class<?> entityClass) { Args.notNull(entityClass, "entity class"); return commandFactory().newCreateTableCommand(this, em(entityClass)).execute(); }
@Override public long count(Class<?> entityClass) { Args.notNull(entityClass,"entity class"); return commandFactory().newCountEntityCommand(this, em(entityClass)).execute(); }