コード例 #1
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#saveAll(java.util.List)
  */
 public <T> List<T> saveAll(List<T> entities) throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(getDataSourceName());
   try {
     return _session.insertAll(entities);
   } finally {
     _session.close();
   }
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#delete(java.lang.Class, java.lang.Object)
  */
 public <T, PK> boolean delete(Class<T> t, PK pk) throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(getDataSourceName());
   try {
     return (_session.delete(t, pk) > 0);
   } finally {
     _session.close();
   }
 }
コード例 #3
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#save(java.lang.Object)
  */
 public <T> T save(T entity) throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(getDataSourceName());
   try {
     return _session.insert(entity);
   } finally {
     _session.close();
   }
 }
コード例 #4
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#load(java.lang.Class, java.lang.Object, java.lang.String[])
  */
 public <T, PK> T load(Class<T> t, PK id, String... fieldFilter)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(this.getDataSourceName());
   try {
     return _session.find(t, id, fieldFilter);
   } finally {
     _session.close();
   }
 }
コード例 #5
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#executeForUpdateAll(java.lang.String, java.util.List)
  */
 public int[] executeForUpdateAll(String sql, List<Object[]> params)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(this.getDataSourceName());
   try {
     return _session.executeForUpdateAll(sql, params);
   } finally {
     _session.close();
   }
 }
コード例 #6
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#findAll(java.lang.String, net.ymate.platform.persistence.jdbc.operator.IResultSetHandler, java.lang.Object[])
  */
 public <T> List<T> findAll(String sql, IResultSetHandler<T> handler, Object[] params)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(this.getDataSourceName());
   try {
     return _session.findAll(sql, handler, params);
   } finally {
     _session.close();
   }
 }
コード例 #7
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#findAll(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.String[])
  */
 public <T> List<T> findAll(Class<T> t, String cond, Object[] params, String... fieldFilter)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(this.getDataSourceName());
   try {
     return _session.findAll(t, cond, fieldFilter, params);
   } finally {
     _session.close();
   }
 }
コード例 #8
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#deleteAll(java.lang.Class, java.lang.Object[])
  */
 public <T> int[] deleteAll(Class<T> t, Object[] ids)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(getDataSourceName());
   try {
     return _session.deleteAll(t, ids);
   } finally {
     _session.close();
   }
 }
コード例 #9
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#updateAll(java.util.List, java.lang.String[])
  */
 public <T> List<T> updateAll(List<T> entities, String... fieldFilter)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(getDataSourceName());
   try {
     return _session.updateAll(entities, fieldFilter);
   } finally {
     _session.close();
   }
 }
コード例 #10
0
 /* (non-Javadoc)
  * @see net.ymate.platform.persistence.jdbc.support.IEntityRepository#findAll(java.lang.Class, java.lang.String, java.lang.Object[], int, int, boolean, java.lang.String[])
  */
 public <T> PageResultSet<T> findAll(
     Class<T> t,
     String cond,
     Object[] params,
     int pageSize,
     int currentPage,
     boolean allowRecordCount,
     String... fieldFilter)
     throws OperatorException, ConnectionException {
   ISession _session = JDBC.openSession(this.getDataSourceName());
   try {
     return _session.findAll(
         t, cond, fieldFilter, pageSize, currentPage, allowRecordCount, params);
   } finally {
     _session.close();
   }
 }