int insert(Object entity)
插入单行记录,这里的参数是一个entity的实例,参数的类型必须是与数据库表有映射的类型.
参数:
结果:
int[] batchInsert(List<?> entities)
批量插入数据库.
int[] batchInsert(Object[] entities)
与int[] batchInsert(List<?> entities)等效,只是参数类型不同.
int[] batchInsert(String entityName,List<?> records)
将对象列表插入到指定的对象映射的数据库表中.
int[] batchInsert(String entityName,Object[] records)
效果与int[] batchInsert(String entityName,List<?> records)相同,仅插入的记录以不同的方式传递而已.
int[] batchInsert(Class<?> entityClass,List<?> records)
效果与效果与int[] batchInsert(String entityName,List<?> records)相同,但是指定插入数据库的映射类以类对象的方式传递.
int[] batchInsert(Class<?> entityClass,Object[] records)
效果与int[] batchInsert(String entityName,Object[] records)相同,但是指定插入数据库的映射类以类对象的方式传递.
int[] batchInsert(EntityMapping em,List<?> records)
效果与int[] batchInsert(String entityName,Object[] records)相同,但是通过直接指定数据库映射对象的方式传递,EntityMapping对象可以用过Dao.getOrmContext().getMetadata().getEntityMapping(entity.class)获取
Dao.getOrmContext().getMetadata().getEntityMapping(entity.class)
int[] batchInsert(EntityMapping em,Object[] records)
效果与int[] batchInsert(String entityName,Object[] records)相同,但是通过直接指定数据库映射对象的方式传递.