View Javadoc

    1   /***
    2    * @(#)MrPersisterServiceImpl.java
    3    *
    4    * JFoxSOAF, Service-Oriented Application Framework
    5    *
    6    * Copyright(c) JFoxSOAF Team
    7    *
    8    * Licensed under the GNU LGPL, Version 2.1 (the "License");
    9    * you may not use this file except in compliance with the License.
    10   * You may obtain a copy of the License at
    11   *
    12   * http://www.gnu.org/copyleft/lesser.html
    13   *
    14   * Unless required by applicable law or agreed to in writing, software
    15   * distributed under the License is distributed on an "AS IS" BASIS,
    16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    17   * See the License for the specific language governing permissions and
    18   * limitations under the License.
    19   *
    20   * For more information, please visit:
    21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
    22   * http://www.huihoo.org/jfox/jfoxsoaf
    23   */
    24
    25  package org.huihoo.jfox.soaf.services.persistence;
    26
    27  import java.sql.Connection;
    28  import java.sql.PreparedStatement;
    29  import java.sql.ResultSet;
    30  import java.sql.SQLException;
    31  import java.sql.Statement;
    32  import java.util.Collection;
    33  import java.util.List;
    34
    35  import javax.sql.DataSource;
    36
    37  import org.huihoo.jfox.soaf.exception.DAOException;
    38
    39  import com.jenkov.mrpersister.PersistenceManager;
    40  import com.jenkov.mrpersister.itf.IGenericDao;
    41  import com.jenkov.mrpersister.itf.IReadFilter;
    42  import com.jenkov.mrpersister.itf.PersistenceException;
    43  import com.jenkov.mrpersister.util.JdbcUtil;
    44
    45  /***
    46   * <p>
    47   * MrPersister persistence service implementation.
    48   * </p>
    49   *
    50   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
    51   * @version $Revision: 1.1 $ $Date: 2006/02/15 08:45:44 $
    52   * @version Revision: 1.0
    53   */
    54
    55  public class MrPersisterServiceImpl implements MrPersisterService {
    56
    57  	private PersistenceManager pm;
    58
    59  	private DataSource dataSource;
    60
    61  	/***
    62  	 *
    63  	 */
    64  	public MrPersisterServiceImpl() {
    65  		this.pm = new PersistenceManager();
    66  	}
    67
    68  	/***
    69  	 * @param dataSource
    70  	 *            The dataSource to set.
    71  	 */
    72  	public void setDataSource(DataSource dataSource) {
    73  		this.dataSource = dataSource;
    74  	}
    75
    76  	private IGenericDao createDao() throws SQLException {
    77  		return pm.getGenericDaoFactory().createDao(dataSource.getConnection());
    78  	}
    79
    80  	private IGenericDao createDao(Connection conn) throws SQLException {
    81  		return pm.getGenericDaoFactory().createDao(conn);
    82  	}
    83
    84  	/***
    85  	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#delete(java.sql.Connection,
    86  	 *      java.lang.Object)
    87  	 */
    88  	public int delete(Connection conn, Object object)
    89  			throws PersistenceException, DAOException {
    90  		int rows = 0;
    91  		IGenericDao dao = null;
    92  		try {
    93  			dao = createDao(conn);
    94  			rows = dao.delete(object);
    95  		} catch (Exception e) {
    96  			throw new DAOException(e);
    97  		}
    98  		return rows;
    99  	}
    100
    101 	/***
    102 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#delete(java.lang.Object)
    103 	 */
    104 	public int delete(Object object) throws PersistenceException, DAOException {
    105 		int rows = 0;
    106 		IGenericDao dao = null;
    107 		try {
    108 			dao = createDao();
    109 			rows = dao.delete(object);
    110 		} catch (Exception e) {
    111 			throw new DAOException(e);
    112 		} finally {
    113 			JdbcUtil.close(dao);
    114 		}
    115 		return rows;
    116 	}
    117
    118 	/***
    119 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#delete(java.lang.Object,
    120 	 *      java.lang.Object)
    121 	 */
    122 	public int delete(Object objectMappingKey, Object object)
    123 			throws PersistenceException, DAOException {
    124 		int rows = 0;
    125 		IGenericDao dao = null;
    126 		try {
    127 			dao = createDao();
    128 			rows = dao.delete(objectMappingKey, object);
    129 		} catch (Exception e) {
    130 			throw new DAOException(e);
    131 		} finally {
    132 			JdbcUtil.close(dao);
    133 		}
    134 		return rows;
    135 	}
    136
    137 	/***
    138 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#delete(java.sql.Connection,
    139 	 *      java.lang.Object, java.lang.Object)
    140 	 */
    141 	public int delete(Connection conn, Object objectMappingKey, Object object)
    142 			throws PersistenceException, DAOException {
    143 		int rows = 0;
    144 		IGenericDao dao = null;
    145 		try {
    146 			dao = createDao(conn);
    147 			rows = dao.delete(objectMappingKey, object);
    148 		} catch (Exception e) {
    149 			throw new DAOException(e);
    150 		}
    151 		return rows;
    152 	}
    153
    154 	/***
    155 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatch(java.util.Collection)
    156 	 */
    157 	public int[] deleteBatch(Collection objects) throws PersistenceException,
    158 			DAOException {
    159 		int[] rows = null;
    160 		IGenericDao dao = null;
    161 		try {
    162 			dao = createDao();
    163 			rows = dao.deleteBatch(objects);
    164 		} catch (Exception e) {
    165 			throw new DAOException(e);
    166 		} finally {
    167 			JdbcUtil.close(dao);
    168 		}
    169 		return rows;
    170 	}
    171
    172 	/***
    173 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatch(java.sql.Connection,
    174 	 *      java.util.Collection)
    175 	 */
    176 	public int[] deleteBatch(Connection conn, Collection objects)
    177 			throws PersistenceException, DAOException {
    178 		int[] rows = null;
    179 		IGenericDao dao = null;
    180 		try {
    181 			dao = createDao(conn);
    182 			rows = dao.deleteBatch(objects);
    183 		} catch (Exception e) {
    184 			throw new DAOException(e);
    185 		}
    186 		return rows;
    187 	}
    188
    189 	/***
    190 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatch(java.sql.Connection,
    191 	 *      java.lang.Object, java.util.Collection)
    192 	 */
    193 	public int[] deleteBatch(Connection conn, Object objectMappingKey,
    194 			Collection objects) throws PersistenceException, DAOException {
    195 		int[] rows = null;
    196 		IGenericDao dao = null;
    197 		try {
    198 			dao = createDao(conn);
    199 			rows = dao.deleteBatch(objectMappingKey, objects);
    200 		} catch (Exception e) {
    201 			throw new DAOException(e);
    202 		}
    203 		return rows;
    204 	}
    205
    206 	/***
    207 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatch(java.lang.Object,
    208 	 *      java.util.Collection)
    209 	 */
    210 	public int[] deleteBatch(Object objectMappingKey, Collection objects)
    211 			throws PersistenceException, DAOException {
    212 		int[] rows = null;
    213 		IGenericDao dao = null;
    214 		try {
    215 			dao = createDao();
    216 			rows = dao.deleteBatch(objectMappingKey, objects);
    217 		} catch (Exception e) {
    218 			throw new DAOException(e);
    219 		} finally {
    220 			JdbcUtil.close(dao);
    221 		}
    222 		return rows;
    223 	}
    224
    225 	/***
    226 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteByPrimaryKey(java.sql.Connection,
    227 	 *      java.lang.Object, java.lang.Object)
    228 	 */
    229 	public int deleteByPrimaryKey(Connection conn, Object objectMappingKey,
    230 			Object primaryKey) throws PersistenceException, DAOException {
    231 		int rows = 0;
    232 		IGenericDao dao = null;
    233 		try {
    234 			dao = createDao(conn);
    235 			rows = dao.deleteByPrimaryKey(objectMappingKey, primaryKey);
    236 		} catch (Exception e) {
    237 			throw new DAOException(e);
    238 		}
    239 		return rows;
    240 	}
    241
    242 	/***
    243 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteByPrimaryKey(java.lang.Object,
    244 	 *      java.lang.Object)
    245 	 */
    246 	public int deleteByPrimaryKey(Object objectMappingKey, Object primaryKey)
    247 			throws PersistenceException, DAOException {
    248 		int rows = 0;
    249 		IGenericDao dao = null;
    250 		try {
    251 			dao = createDao();
    252 			rows = dao.deleteByPrimaryKey(objectMappingKey, primaryKey);
    253 		} catch (Exception e) {
    254 			throw new DAOException(e);
    255 		} finally {
    256 			JdbcUtil.close(dao);
    257 		}
    258 		return rows;
    259 	}
    260
    261 	/***
    262 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatchByPrimaryKeys(java.lang.Object,
    263 	 *      java.util.Collection)
    264 	 */
    265 	public int[] deleteBatchByPrimaryKeys(Object objectMappingKey,
    266 			Collection primaryKeys) throws PersistenceException, DAOException {
    267 		int[] rows = null;
    268 		IGenericDao dao = null;
    269 		try {
    270 			dao = createDao();
    271 			rows = dao.deleteBatchByPrimaryKeys(objectMappingKey,
    272 					primaryKeys);
    273 		} catch (Exception e) {
    274 			throw new DAOException(e);
    275 		} finally {
    276 			JdbcUtil.close(dao);
    277 		}
    278 		return rows;
    279 	}
    280
    281 	/***
    282 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#deleteBatchByPrimaryKeys(java.sql.Connection,
    283 	 *      java.lang.Object, java.util.Collection)
    284 	 */
    285 	public int[] deleteBatchByPrimaryKeys(Connection conn,
    286 			Object objectMappingKey, Collection primaryKeys)
    287 			throws PersistenceException, DAOException {
    288 		int[] rows = null;
    289 		IGenericDao dao = null;
    290 		try {
    291 			dao = createDao(conn);
    292 			rows = dao.deleteBatchByPrimaryKeys(objectMappingKey,
    293 					primaryKeys);
    294 		} catch (Exception e) {
    295 			throw new DAOException(e);
    296 		}
    297 		return rows;
    298 	}
    299
    300 	/***
    301 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.lang.String,
    302 	 *      java.util.Collection)
    303 	 */
    304 	public int executeUpdate(String sql, Collection parameters)
    305 			throws PersistenceException {
    306 		int nums = 0;
    307 		IGenericDao dao = null;
    308 		try {
    309 			dao = createDao();
    310 			nums = dao.executeUpdate(sql, parameters);
    311 		} catch (Exception e) {
    312 			throw new DAOException(e);
    313 		} finally {
    314 			JdbcUtil.close(dao);
    315 		}
    316 		return nums;
    317 	}
    318
    319 	/***
    320 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.sql.Connection,
    321 	 *      java.lang.String, java.util.Collection)
    322 	 */
    323 	public int executeUpdate(Connection conn, String sql, Collection parameters)
    324 			throws PersistenceException, DAOException {
    325 		int nums = 0;
    326 		IGenericDao dao = null;
    327 		try {
    328 			dao = createDao(conn);
    329 			nums = dao.executeUpdate(sql, parameters);
    330 		} catch (Exception e) {
    331 			throw new DAOException(e);
    332 		}
    333 		return nums;
    334 	}
    335
    336 	/***
    337 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.lang.String,
    338 	 *      java.lang.Object[])
    339 	 */
    340 	public int executeUpdate(String sql, Object[] parameters)
    341 			throws PersistenceException {
    342 		int nums = 0;
    343 		IGenericDao dao = null;
    344 		try {
    345 			dao = createDao();
    346 			nums = dao.executeUpdate(sql, parameters);
    347 		} catch (Exception e) {
    348 			throw new DAOException(e);
    349 		} finally {
    350 			JdbcUtil.close(dao);
    351 		}
    352 		return nums;
    353 	}
    354
    355 	/***
    356 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.sql.Connection,
    357 	 *      java.lang.String, java.lang.Object[])
    358 	 */
    359 	public int executeUpdate(Connection conn, String sql, Object[] parameters)
    360 			throws PersistenceException, DAOException {
    361 		int nums = 0;
    362 		IGenericDao dao = null;
    363 		try {
    364 			dao = createDao(conn);
    365 			nums = dao.executeUpdate(sql, parameters);
    366 		} catch (Exception e) {
    367 			throw new DAOException(e);
    368 		}
    369 		return nums;
    370 	}
    371
    372 	/***
    373 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.lang.String)
    374 	 */
    375 	public int executeUpdate(String sql) throws PersistenceException,
    376 			DAOException {
    377 		int nums = 0;
    378 		IGenericDao dao = null;
    379 		try {
    380 			dao = createDao();
    381 			nums = dao.executeUpdate(sql);
    382 		} catch (Exception e) {
    383 			throw new DAOException(e);
    384 		} finally {
    385 			JdbcUtil.close(dao);
    386 		}
    387 		return nums;
    388 	}
    389
    390 	/***
    391 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#executeUpdate(java.sql.Connection,
    392 	 *      java.lang.String)
    393 	 */
    394 	public int executeUpdate(Connection conn, String sql)
    395 			throws PersistenceException, DAOException {
    396 		int nums = 0;
    397 		IGenericDao dao = null;
    398 		try {
    399 			dao = createDao(conn);
    400 			nums = dao.executeUpdate(sql);
    401 		} catch (Exception e) {
    402 			throw new DAOException(e);
    403 		}
    404 		return nums;
    405 	}
    406
    407 	/***
    408 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insert(java.lang.Object,
    409 	 *      java.lang.Object)
    410 	 */
    411 	public int insert(Object objectMappingKey, Object object)
    412 			throws PersistenceException {
    413 		int nums = 0;
    414 		IGenericDao dao = null;
    415 		try {
    416 			dao = createDao();
    417 			nums = dao.insert(objectMappingKey, object);
    418 		} catch (Exception e) {
    419 			throw new DAOException(e);
    420 		} finally {
    421 			JdbcUtil.close(dao);
    422 		}
    423 		return nums;
    424 	}
    425
    426 	/***
    427 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insert(java.sql.Connection,
    428 	 *      java.lang.Object, java.lang.Object)
    429 	 */
    430 	public int insert(Connection conn, Object objectMappingKey, Object object)
    431 			throws PersistenceException, DAOException {
    432 		int nums = 0;
    433 		IGenericDao dao = null;
    434 		try {
    435 			dao = createDao(conn);
    436 			nums = dao.insert(objectMappingKey, object);
    437 		} catch (Exception e) {
    438 			throw new DAOException(e);
    439 		}
    440 		return nums;
    441 	}
    442
    443 	/***
    444 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insert(java.lang.Object)
    445 	 */
    446 	public int insert(Object object) throws PersistenceException {
    447 		int nums = 0;
    448 		IGenericDao dao = null;
    449 		try {
    450 			dao = createDao();
    451 			nums = dao.insert(object);
    452 		} catch (Exception e) {
    453 			throw new DAOException(e);
    454 		} finally {
    455 			JdbcUtil.close(dao);
    456 		}
    457 		return nums;
    458 	}
    459
    460 	/***
    461 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insert(java.sql.Connection,
    462 	 *      java.lang.Object)
    463 	 */
    464 	public int insert(Connection conn, Object object)
    465 			throws PersistenceException, DAOException {
    466 		int nums = 0;
    467 		IGenericDao dao = null;
    468 		try {
    469 			dao = createDao(conn);
    470 			nums = dao.insert(object);
    471 		} catch (Exception e) {
    472 			throw new DAOException(e);
    473 		}
    474 		return nums;
    475 	}
    476
    477 	/*
    478 	 * 8
    479 	 *
    480 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insertBatch(java.util.Collection)
    481 	 */
    482 	public int[] insertBatch(Collection objects) throws PersistenceException {
    483 		int[] nums = null;
    484 		IGenericDao dao = null;
    485 		try {
    486 			dao = createDao();
    487 			nums = dao.insertBatch(objects);
    488 		} catch (Exception e) {
    489 			throw new DAOException(e);
    490 		} finally {
    491 			JdbcUtil.close(dao);
    492 		}
    493 		return nums;
    494 	}
    495
    496 	/***
    497 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insertBatch(java.lang.Object,
    498 	 *      java.util.Collection)
    499 	 */
    500 	public int[] insertBatch(Object objectMappingKey, Collection objects)
    501 			throws PersistenceException {
    502 		int[] nums = null;
    503 		IGenericDao dao = null;
    504 		try {
    505 			dao = createDao();
    506 			nums = dao.insertBatch(objectMappingKey, objects);
    507 		} catch (Exception e) {
    508 			throw new DAOException(e);
    509 		} finally {
    510 			JdbcUtil.close(dao);
    511 		}
    512 		return nums;
    513 	}
    514
    515 	/***
    516 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#insertBatch(java.sql.Connection,
    517 	 *      java.util.Collection)
    518 	 */
    519 	public int[] insertBatch(Connection conn, Collection objects)
    520 			throws PersistenceException, DAOException {
    521 		int[] nums = null;
    522 		IGenericDao dao = null;
    523 		try {
    524 			dao = createDao(conn);
    525 			nums = dao.insertBatch(objects);
    526 		} catch (Exception e) {
    527 			throw new DAOException(e);
    528 		}
    529 		return nums;
    530 	}
    531
    532 	/***
    533 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    534 	 *      java.sql.PreparedStatement)
    535 	 */
    536 	public Object read(Object objectMappingKey, PreparedStatement statement)
    537 			throws PersistenceException {
    538 		Object object = null;
    539 		IGenericDao dao = null;
    540 		try {
    541 			dao = createDao();
    542 			object = dao.read(objectMappingKey, statement);
    543 		} catch (Exception e) {
    544 			throw new DAOException(e);
    545 		} finally {
    546 			JdbcUtil.close(dao);
    547 		}
    548 		return object;
    549 	}
    550
    551 	/***
    552 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.sql.Connection,
    553 	 *      java.lang.Object, java.sql.PreparedStatement)
    554 	 */
    555 	public Object read(Connection conn, Object objectMappingKey,
    556 			PreparedStatement statement) throws PersistenceException,
    557 			DAOException {
    558 		Object object = null;
    559 		IGenericDao dao = null;
    560 		try {
    561 			dao = createDao(conn);
    562 			object = dao.read(objectMappingKey, statement);
    563 		} catch (Exception e) {
    564 			throw new DAOException(e);
    565 		}
    566 		return object;
    567 	}
    568
    569 	/***
    570 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    571 	 *      java.sql.ResultSet)
    572 	 */
    573 	public Object read(Object objectMappingKey, ResultSet result)
    574 			throws PersistenceException {
    575 		Object object = null;
    576 		IGenericDao dao = null;
    577 		try {
    578 			dao = createDao();
    579 			object = dao.read(objectMappingKey, result);
    580 		} catch (Exception e) {
    581 			throw new DAOException(e);
    582 		} finally {
    583 			JdbcUtil.close(dao);
    584 		}
    585 		return object;
    586 	}
    587
    588 	/***
    589 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.sql.Connection,
    590 	 *      java.lang.Object, java.sql.ResultSet)
    591 	 */
    592 	public Object read(Connection conn, Object objectMappingKey,
    593 			ResultSet result) throws PersistenceException, DAOException {
    594 		Object object = null;
    595 		IGenericDao dao = null;
    596 		try {
    597 			dao = createDao(conn);
    598 			object = dao.read(objectMappingKey, result);
    599 		} catch (Exception e) {
    600 			throw new DAOException(e);
    601 		}
    602 		return object;
    603 	}
    604
    605 	/***
    606 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    607 	 *      java.sql.Statement, java.lang.String)
    608 	 */
    609 	public Object read(Object objectMappingKey, Statement statement, String sql)
    610 			throws PersistenceException, DAOException {
    611 		Object object = null;
    612 		IGenericDao dao = null;
    613 		try {
    614 			dao = createDao();
    615 			object = dao.read(objectMappingKey, statement, sql);
    616 		} catch (Exception e) {
    617 			throw new DAOException(e);
    618 		} finally {
    619 			JdbcUtil.close(dao);
    620 		}
    621 		return object;
    622 	}
    623
    624 	/***
    625 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.sql.Connection,
    626 	 *      java.lang.Object, java.sql.Statement, java.lang.String)
    627 	 */
    628 	public Object read(Connection conn, Object objectMappingKey,
    629 			Statement statement, String sql) throws PersistenceException,
    630 			DAOException {
    631 		Object object = null;
    632 		IGenericDao dao = null;
    633 		try {
    634 			dao = createDao(conn);
    635 			object = dao.read(objectMappingKey, statement, sql);
    636 		} catch (Exception e) {
    637 			throw new DAOException(e);
    638 		}
    639 		return object;
    640 	}
    641
    642 	/***
    643 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    644 	 *      java.lang.String, java.util.Collection)
    645 	 */
    646 	public Object read(Object objectMappingKey, String sql,
    647 			Collection parameters) throws PersistenceException {
    648 		Object object = null;
    649 		IGenericDao dao = null;
    650 		try {
    651 			dao = createDao();
    652 			object = dao.read(objectMappingKey, sql, parameters);
    653 		} catch (Exception e) {
    654 			throw new DAOException(e);
    655 		} finally {
    656 			JdbcUtil.close(dao);
    657 		}
    658 		return object;
    659 	}
    660
    661 	/***
    662 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.sql.Connection,
    663 	 *      java.lang.Object, java.lang.String, java.util.Collection)
    664 	 */
    665 	public Object read(Connection conn, Object objectMappingKey, String sql,
    666 			Collection parameters) throws PersistenceException, DAOException {
    667 		Object object = null;
    668 		IGenericDao dao = null;
    669 		try {
    670 			dao = createDao(conn);
    671 			object = dao.read(objectMappingKey, sql, parameters);
    672 		} catch (Exception e) {
    673 			throw new DAOException(e);
    674 		}
    675 		return object;
    676 	}
    677
    678 	/***
    679 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    680 	 *      java.lang.String, java.lang.Object[])
    681 	 */
    682 	public Object read(Object objectMappingKey, String sql, Object[] parameters)
    683 			throws PersistenceException {
    684 		Object object = null;
    685 		IGenericDao dao = null;
    686 		try {
    687 			dao = createDao();
    688 			object = dao.read(objectMappingKey, sql, parameters);
    689 		} catch (Exception e) {
    690 			throw new DAOException(e);
    691 		} finally {
    692 			JdbcUtil.close(dao);
    693 		}
    694 		return object;
    695 	}
    696
    697 	/***
    698 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.sql.Connection,
    699 	 *      java.lang.Object, java.lang.String, java.lang.Object[])
    700 	 */
    701 	public Object read(Connection conn, Object objectMappingKey, String sql,
    702 			Object[] parameters) throws PersistenceException, DAOException {
    703 		Object object = null;
    704 		IGenericDao dao = null;
    705 		try {
    706 			dao = createDao(conn);
    707 			object = dao.read(objectMappingKey, sql, parameters);
    708 		} catch (Exception e) {
    709 			throw new DAOException(e);
    710 		}
    711 		return object;
    712 	}
    713
    714 	/***
    715 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    716 	 *      java.lang.String)
    717 	 */
    718 	public Object read(Object objectMappingKey, String sql)
    719 			throws PersistenceException, DAOException {
    720 		Object object = null;
    721 		IGenericDao dao = null;
    722 		try {
    723 			dao = createDao();
    724 			object = dao.read(objectMappingKey, sql);
    725 		} catch (Exception e) {
    726 			throw new DAOException(e);
    727 		} finally {
    728 			JdbcUtil.close(dao);
    729 		}
    730 		return object;
    731 	}
    732
    733 	/***
    734 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#read(java.lang.Object,
    735 	 *      java.lang.String)
    736 	 */
    737 	public Object read(Connection conn, Object objectMappingKey, String sql)
    738 			throws PersistenceException, DAOException {
    739 		Object object = null;
    740 		IGenericDao dao = null;
    741 		try {
    742 			dao = createDao(conn);
    743 			object = dao.read(objectMappingKey, sql);
    744 		} catch (Exception e) {
    745 			throw new DAOException(e);
    746 		}
    747 		return object;
    748 	}
    749
    750 	/***
    751 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readByPrimaryKey(java.lang.Object,
    752 	 *      java.lang.Object)
    753 	 */
    754 	public Object readByPrimaryKey(Object objectMappingKey, Object primaryKey)
    755 			throws PersistenceException {
    756 		Object object = null;
    757 		IGenericDao dao = null;
    758 		try {
    759 			dao = createDao();
    760 			object = dao.readByPrimaryKey(objectMappingKey, primaryKey);
    761 		} catch (Exception e) {
    762 			throw new DAOException(e);
    763 		} finally {
    764 			JdbcUtil.close(dao);
    765 		}
    766 		return object;
    767 	}
    768
    769 	/***
    770 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readByPrimaryKey(java.sql.Connection,
    771 	 *      java.lang.Object, java.lang.Object)
    772 	 */
    773 	public Object readByPrimaryKey(Connection conn, Object objectMappingKey,
    774 			Object primaryKey) throws PersistenceException, DAOException {
    775 		Object object = null;
    776 		IGenericDao dao = null;
    777 		try {
    778 			dao = createDao(conn);
    779 			object = dao.readByPrimaryKey(objectMappingKey, primaryKey);
    780 		} catch (Exception e) {
    781 			throw new DAOException(e);
    782 		}
    783 		return object;
    784 	}
    785
    786 	/***
    787 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    788 	 *      java.sql.PreparedStatement, com.jenkov.mrpersister.itf.IReadFilter)
    789 	 */
    790 	public List readList(Object objectMappingKey, PreparedStatement statement,
    791 			IReadFilter filter) throws PersistenceException {
    792 		List list = null;
    793 		IGenericDao dao = null;
    794 		try {
    795 			dao = createDao();
    796 			list = dao.readList(objectMappingKey, statement, filter);
    797 		} catch (Exception e) {
    798 			throw new DAOException(e);
    799 		} finally {
    800 			JdbcUtil.close(dao);
    801 		}
    802 		return list;
    803 	}
    804
    805 	/***
    806 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    807 	 *      java.lang.Object, java.sql.PreparedStatement,
    808 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    809 	 */
    810 	public List readList(Connection conn, Object objectMappingKey,
    811 			PreparedStatement statement, IReadFilter filter)
    812 			throws PersistenceException, DAOException {
    813 		List list = null;
    814 		IGenericDao dao = null;
    815 		try {
    816 			dao = createDao(conn);
    817 			list = dao.readList(objectMappingKey, statement, filter);
    818 		} catch (Exception e) {
    819 			throw new DAOException(e);
    820 		}
    821 		return list;
    822 	}
    823
    824 	/***
    825 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    826 	 *      java.sql.PreparedStatement)
    827 	 */
    828 	public List readList(Object objectMappingKey, PreparedStatement statement)
    829 			throws PersistenceException {
    830 		List list = null;
    831 		IGenericDao dao = null;
    832 		try {
    833 			dao = createDao();
    834 			list = dao.readList(objectMappingKey, statement);
    835 		} catch (Exception e) {
    836 			throw new DAOException(e);
    837 		} finally {
    838 			JdbcUtil.close(dao);
    839 		}
    840 		return list;
    841 	}
    842
    843 	/***
    844 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    845 	 *      java.lang.Object, java.sql.PreparedStatement)
    846 	 */
    847 	public List readList(Connection conn, Object objectMappingKey,
    848 			PreparedStatement statement) throws PersistenceException,
    849 			DAOException {
    850 		List list = null;
    851 		IGenericDao dao = null;
    852 		try {
    853 			dao = createDao(conn);
    854 			list = dao.readList(objectMappingKey, statement);
    855 		} catch (Exception e) {
    856 			throw new DAOException(e);
    857 		}
    858 		return list;
    859 	}
    860
    861 	/***
    862 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    863 	 *      java.sql.ResultSet, com.jenkov.mrpersister.itf.IReadFilter)
    864 	 */
    865 	public List readList(Object objectMappingKey, ResultSet result,
    866 			IReadFilter filter) throws PersistenceException {
    867 		List list = null;
    868 		IGenericDao dao = null;
    869 		try {
    870 			dao = createDao();
    871 			list = dao.readList(objectMappingKey, result, filter);
    872 		} catch (Exception e) {
    873 			throw new DAOException(e);
    874 		} finally {
    875 			JdbcUtil.close(dao);
    876 		}
    877 		return list;
    878 	}
    879
    880 	/***
    881 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    882 	 *      java.lang.Object, java.sql.ResultSet,
    883 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    884 	 */
    885 	public List readList(Connection conn, Object objectMappingKey,
    886 			ResultSet result, IReadFilter filter) throws PersistenceException,
    887 			DAOException {
    888 		List list = null;
    889 		IGenericDao dao = null;
    890 		try {
    891 			dao = createDao(conn);
    892 			list = dao.readList(objectMappingKey, result, filter);
    893 		} catch (Exception e) {
    894 			throw new DAOException(e);
    895 		}
    896 		return list;
    897 	}
    898
    899 	/***
    900 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    901 	 *      java.sql.ResultSet)
    902 	 */
    903 	public List readList(Object objectMappingKey, ResultSet result)
    904 			throws PersistenceException {
    905 		List list = null;
    906 		IGenericDao dao = null;
    907 		try {
    908 			dao = createDao();
    909 			list = dao.readList(objectMappingKey, result);
    910 		} catch (Exception e) {
    911 			throw new DAOException(e);
    912 		} finally {
    913 			JdbcUtil.close(dao);
    914 		}
    915 		return list;
    916 	}
    917
    918 	/***
    919 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    920 	 *      java.lang.Object, java.sql.ResultSet)
    921 	 */
    922 	public List readList(Connection conn, Object objectMappingKey,
    923 			ResultSet result) throws PersistenceException, DAOException {
    924 		List list = null;
    925 		IGenericDao dao = null;
    926 		try {
    927 			dao = createDao(conn);
    928 			list = dao.readList(objectMappingKey, result);
    929 		} catch (Exception e) {
    930 			throw new DAOException(e);
    931 		}
    932 		return list;
    933 	}
    934
    935 	/***
    936 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    937 	 *      java.sql.Statement, java.lang.String)
    938 	 */
    939 	public List readList(Object objectMappingKey, Statement statement,
    940 			String sql) throws PersistenceException {
    941 		List list = null;
    942 		IGenericDao dao = null;
    943 		try {
    944 			dao = createDao();
    945 			list = dao.readList(objectMappingKey, statement, sql);
    946 		} catch (Exception e) {
    947 			throw new DAOException(e);
    948 		} finally {
    949 			JdbcUtil.close(dao);
    950 		}
    951 		return list;
    952 	}
    953
    954 	/***
    955 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    956 	 *      java.lang.Object, java.sql.Statement, java.lang.String)
    957 	 */
    958 	public List readList(Connection conn, Object objectMappingKey,
    959 			Statement statement, String sql) throws PersistenceException,
    960 			DAOException {
    961 		List list = null;
    962 		IGenericDao dao = null;
    963 		try {
    964 			dao = createDao(conn);
    965 			list = dao.readList(objectMappingKey, statement, sql);
    966 		} catch (Exception e) {
    967 			throw new DAOException(e);
    968 		}
    969 		return list;
    970 	}
    971
    972 	/***
    973 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    974 	 *      java.lang.String, java.util.Collection,
    975 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    976 	 */
    977 	public List readList(Object objectMappingKey, String sql,
    978 			Collection parameters, IReadFilter filter)
    979 			throws PersistenceException {
    980 		List list = null;
    981 		IGenericDao dao = null;
    982 		try {
    983 			dao = createDao();
    984 			list = dao.readList(objectMappingKey, sql, parameters,
    985 					filter);
    986 		} catch (Exception e) {
    987 			throw new DAOException(e);
    988 		} finally {
    989 			JdbcUtil.close(dao);
    990 		}
    991 		return list;
    992 	}
    993
    994 	/***
    995 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    996 	 *      java.lang.Object, java.lang.String, java.util.Collection,
    997 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    998 	 */
    999 	public List readList(Connection conn, Object objectMappingKey, String sql,
    1000 			Collection parameters, IReadFilter filter)
    1001 			throws PersistenceException, DAOException {
    1002 		List list = null;
    1003 		IGenericDao dao = null;
    1004 		try {
    1005 			dao = createDao(conn);
    1006 			list = dao.readList(objectMappingKey, sql, parameters,
    1007 					filter);
    1008 		} catch (Exception e) {
    1009 			throw new DAOException(e);
    1010 		}
    1011 		return list;
    1012 	}
    1013
    1014 	/***
    1015 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1016 	 *      java.sql.Statement, java.lang.String,
    1017 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    1018 	 */
    1019 	public List readList(Object objectMappingKey, Statement statement,
    1020 			String sql, IReadFilter filter) throws PersistenceException {
    1021 		List list = null;
    1022 		IGenericDao dao = null;
    1023 		try {
    1024 			dao = createDao();
    1025 			list = dao
    1026 					.readList(objectMappingKey, statement, sql, filter);
    1027 		} catch (Exception e) {
    1028 			throw new DAOException(e);
    1029 		} finally {
    1030 			JdbcUtil.close(dao);
    1031 		}
    1032 		return list;
    1033 	}
    1034
    1035 	/***
    1036 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    1037 	 *      java.lang.Object, java.sql.Statement, java.lang.String,
    1038 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    1039 	 */
    1040 	public List readList(Connection conn, Object objectMappingKey,
    1041 			Statement statement, String sql, IReadFilter filter)
    1042 			throws PersistenceException, DAOException {
    1043 		List list = null;
    1044 		IGenericDao dao = null;
    1045 		try {
    1046 			dao = createDao(conn);
    1047 			list = dao
    1048 					.readList(objectMappingKey, statement, sql, filter);
    1049 		} catch (Exception e) {
    1050 			throw new DAOException(e);
    1051 		}
    1052 		return list;
    1053 	}
    1054
    1055 	/***
    1056 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1057 	 *      java.lang.String, java.util.Collection)
    1058 	 */
    1059 	public List readList(Object objectMappingKey, String sql,
    1060 			Collection parameters) throws PersistenceException, DAOException {
    1061 		List list = null;
    1062 		IGenericDao dao = null;
    1063 		try {
    1064 			dao = createDao();
    1065 			list = dao.readList(objectMappingKey, sql, parameters);
    1066 		} catch (Exception e) {
    1067 			throw new DAOException(e);
    1068 		} finally {
    1069 			JdbcUtil.close(dao);
    1070 		}
    1071 		return list;
    1072 	}
    1073
    1074 	/***
    1075 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    1076 	 *      java.lang.Object, java.lang.String, java.util.Collection)
    1077 	 */
    1078 	public List readList(Connection conn, Object objectMappingKey, String sql,
    1079 			Collection parameters) throws PersistenceException, DAOException {
    1080 		List list = null;
    1081 		IGenericDao dao = null;
    1082 		try {
    1083 			dao = createDao(conn);
    1084 			list = dao.readList(objectMappingKey, sql, parameters);
    1085 		} catch (Exception e) {
    1086 			throw new DAOException(e);
    1087 		}
    1088 		return list;
    1089 	}
    1090
    1091 	/***
    1092 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1093 	 *      java.lang.String, com.jenkov.mrpersister.itf.IReadFilter)
    1094 	 */
    1095 	public List readList(Object objectMappingKey, String sql, IReadFilter filter)
    1096 			throws PersistenceException {
    1097 		List list = null;
    1098 		IGenericDao dao = null;
    1099 		try {
    1100 			dao = createDao();
    1101 			list = dao.readList(objectMappingKey, sql, filter);
    1102 		} catch (Exception e) {
    1103 			throw new DAOException(e);
    1104 		} finally {
    1105 			JdbcUtil.close(dao);
    1106 		}
    1107 		return list;
    1108 	}
    1109
    1110 	/***
    1111 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection, java.lang.Object, java.lang.String, com.jenkov.mrpersister.itf.IReadFilter)
    1112 	 */
    1113 	public List readList(Connection conn, Object objectMappingKey, String sql,
    1114 			IReadFilter filter) throws PersistenceException, DAOException {
    1115 		List list = null;
    1116 		IGenericDao dao = null;
    1117 		try {
    1118 			dao = createDao(conn);
    1119 			list = dao.readList(objectMappingKey, sql, filter);
    1120 		} catch (Exception e) {
    1121 			throw new DAOException(e);
    1122 		}
    1123 		return list;
    1124 	}
    1125
    1126
    1127 	/***
    1128 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1129 	 *      java.lang.String, java.lang.Object[],
    1130 	 *      com.jenkov.mrpersister.itf.IReadFilter)
    1131 	 */
    1132 	public List readList(Object objectMappingKey, String sql,
    1133 			Object[] parameters, IReadFilter filter)
    1134 			throws PersistenceException {
    1135 		List list = null;
    1136 		IGenericDao dao = null;
    1137 		try {
    1138 			dao = createDao();
    1139 			list = dao.readList(objectMappingKey, sql, parameters, filter);
    1140 		} catch (Exception e) {
    1141 			throw new DAOException(e);
    1142 		} finally {
    1143 			JdbcUtil.close(dao);
    1144 		}
    1145 		return list;
    1146 	}
    1147
    1148 	/***
    1149 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection, java.lang.Object, java.lang.String, java.lang.Object[], com.jenkov.mrpersister.itf.IReadFilter)
    1150 	 */
    1151 	public List readList(Connection conn, Object objectMappingKey, String sql,
    1152 			Object[] parameters, IReadFilter filter)
    1153 			throws PersistenceException, DAOException {
    1154 		List list = null;
    1155 		IGenericDao dao = null;
    1156 		try {
    1157 			dao = createDao(conn);
    1158 			list = dao.readList(objectMappingKey, sql, parameters, filter);
    1159 		} catch (Exception e) {
    1160 			throw new DAOException(e);
    1161 		}
    1162 		return list;
    1163 	}
    1164
    1165
    1166 	/***
    1167 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1168 	 *      java.lang.String, java.lang.Object[])
    1169 	 */
    1170 	public List readList(Object objectMappingKey, String sql,
    1171 			Object[] parameters) throws PersistenceException {
    1172 		List list = null;
    1173 		IGenericDao dao = null;
    1174 		try {
    1175 			dao = createDao();
    1176 			list = dao.readList(objectMappingKey, sql, parameters);
    1177 		} catch (Exception e) {
    1178 			throw new DAOException(e);
    1179 		} finally {
    1180 			JdbcUtil.close(dao);
    1181 		}
    1182 		return list;
    1183 	}
    1184
    1185 	/***
    1186 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection, java.lang.Object, java.lang.String, java.lang.Object[])
    1187 	 */
    1188 	public List readList(Connection conn, Object objectMappingKey, String sql,
    1189 			Object[] parameters) throws PersistenceException, DAOException {
    1190 		List list = null;
    1191 		IGenericDao dao = null;
    1192 		try {
    1193 			dao = createDao(conn);
    1194 			list = dao.readList(objectMappingKey, sql, parameters);
    1195 		} catch (Exception e) {
    1196 			throw new DAOException(e);
    1197 		}
    1198 		return list;
    1199 	}
    1200
    1201
    1202 	/***
    1203 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.lang.Object,
    1204 	 *      java.lang.String)
    1205 	 */
    1206 	public List readList(Object objectMappingKey, String sql)
    1207 			throws PersistenceException, DAOException {
    1208 		List list = null;
    1209 		IGenericDao dao = null;
    1210 		try {
    1211 			dao = createDao();
    1212 			list = dao.readList(objectMappingKey, sql);
    1213 		} catch (Exception e) {
    1214 			throw new DAOException(e);
    1215 		} finally {
    1216 			JdbcUtil.close(dao);
    1217 		}
    1218 		return list;
    1219 	}
    1220
    1221 	/***
    1222 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readList(java.sql.Connection,
    1223 	 *      java.lang.Object, java.lang.String)
    1224 	 */
    1225 	public List readList(Connection conn, Object objectMappingKey, String sql)
    1226 			throws PersistenceException, DAOException {
    1227 		List list = null;
    1228 		IGenericDao dao = null;
    1229 		try {
    1230 			dao = createDao(conn);
    1231 			list = dao.readList(objectMappingKey, sql);
    1232 		} catch (Exception e) {
    1233 			throw new DAOException(e);
    1234 		}
    1235 		return list;
    1236 	}
    1237
    1238 	/***
    1239 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readListByPrimaryKeys(java.lang.Object,
    1240 	 *      java.util.Collection)
    1241 	 */
    1242 	public List readListByPrimaryKeys(Object objectMappingKey,
    1243 			Collection primaryKeys) throws PersistenceException {
    1244 		List list = null;
    1245 		IGenericDao dao = null;
    1246 		try {
    1247 			dao = createDao();
    1248 			list = dao.readListByPrimaryKeys(objectMappingKey, primaryKeys);
    1249 		} catch (Exception e) {
    1250 			throw new DAOException(e);
    1251 		} finally {
    1252 			JdbcUtil.close(dao);
    1253 		}
    1254 		return list;
    1255 	}
    1256
    1257 	/***
    1258 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#readListByPrimaryKeys(java.sql.Connection, java.lang.Object, java.util.Collection)
    1259 	 */
    1260 	public List readListByPrimaryKeys(Connection conn, Object objectMappingKey,
    1261 			Collection primaryKeys) throws PersistenceException, DAOException {
    1262 		List list = null;
    1263 		IGenericDao dao = null;
    1264 		try {
    1265 			dao = createDao(conn);
    1266 			list = dao.readListByPrimaryKeys(objectMappingKey, primaryKeys);
    1267 		} catch (Exception e) {
    1268 			throw new DAOException(e);
    1269 		}
    1270 		return list;
    1271 	}
    1272
    1273 	/***
    1274 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#update(java.lang.Object,
    1275 	 *      java.lang.Object)
    1276 	 */
    1277 	public int update(Object objectMappingKey, Object object)
    1278 			throws PersistenceException {
    1279 		int nums = 0;
    1280 		IGenericDao dao = null;
    1281 		try {
    1282 			dao = createDao();
    1283 			nums = dao.update(objectMappingKey, object);
    1284 		} catch (Exception e) {
    1285 			throw new DAOException(e);
    1286 		} finally {
    1287 			JdbcUtil.close(dao);
    1288 		}
    1289 		return nums;
    1290 	}
    1291
    1292 	/***
    1293 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#update(java.sql.Connection, java.lang.Object, java.lang.Object)
    1294 	 */
    1295 	public int update(Connection conn, Object objectMappingKey, Object object)
    1296 			throws PersistenceException, DAOException {
    1297 		int nums = 0;
    1298 		IGenericDao dao = null;
    1299 		try {
    1300 			dao = createDao(conn);
    1301 			nums = dao.update(objectMappingKey, object);
    1302 		} catch (Exception e) {
    1303 			throw new DAOException(e);
    1304 		}
    1305 		return nums;
    1306 	}
    1307
    1308
    1309 	/***
    1310 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#update(java.lang.Object)
    1311 	 */
    1312 	public int update(Object object) throws PersistenceException {
    1313 		int nums = 0;
    1314 		IGenericDao dao = null;
    1315 		try {
    1316 			dao = createDao();
    1317 			nums = dao.update(object);
    1318 		} catch (Exception e) {
    1319 			throw new DAOException(e);
    1320 		} finally {
    1321 			JdbcUtil.close(dao);
    1322 		}
    1323 		return nums;
    1324 	}
    1325
    1326 	/***
    1327 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#update(java.sql.Connection, java.lang.Object)
    1328 	 */
    1329 	public int update(Connection conn, Object object)
    1330 			throws PersistenceException, DAOException {
    1331 		int nums = 0;
    1332 		IGenericDao dao = null;
    1333 		try {
    1334 			dao = createDao(conn);
    1335 			nums = dao.update(object);
    1336 		} catch (Exception e) {
    1337 			throw new DAOException(e);
    1338 		}
    1339 		return nums;
    1340 	}
    1341
    1342
    1343 	/***
    1344 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatch(java.util.Collection)
    1345 	 */
    1346 	public int[] updateBatch(Collection objects) throws PersistenceException {
    1347 		int[] nums = null;
    1348 		IGenericDao dao = null;
    1349 		try {
    1350 			dao = createDao();
    1351 			nums = dao.updateBatch(objects);
    1352 		} catch (Exception e) {
    1353 			throw new DAOException(e);
    1354 		} finally {
    1355 			JdbcUtil.close(dao);
    1356 		}
    1357 		return nums;
    1358 	}
    1359
    1360 	/***
    1361 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatch(java.sql.Connection, java.util.Collection)
    1362 	 */
    1363 	public int[] updateBatch(Connection conn, Collection objects)
    1364 			throws PersistenceException, DAOException {
    1365 		int[] nums = null;
    1366 		IGenericDao dao = null;
    1367 		try {
    1368 			dao = createDao(conn);
    1369 			nums = dao.updateBatch(objects);
    1370 		} catch (Exception e) {
    1371 			throw new DAOException(e);
    1372 		}
    1373 		return nums;
    1374 	}
    1375
    1376 	/***
    1377 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatch(java.lang.Object,
    1378 	 *      java.util.Collection)
    1379 	 */
    1380 	public int[] updateBatch(Object objectMappingKey, Collection objects)
    1381 			throws PersistenceException {
    1382 		int[] nums = null;
    1383 		IGenericDao dao = null;
    1384 		try {
    1385 			dao = createDao();
    1386 			nums = dao.updateBatch(objectMappingKey, objects);
    1387 		} catch (Exception e) {
    1388 			throw new DAOException(e);
    1389 		} finally {
    1390 			JdbcUtil.close(dao);
    1391 		}
    1392 		return nums;
    1393 	}
    1394
    1395 	/***
    1396 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatch(java.sql.Connection, java.lang.Object, java.util.Collection)
    1397 	 */
    1398 	public int[] updateBatch(Connection conn, Object objectMappingKey,
    1399 			Collection objects) throws PersistenceException, DAOException {
    1400 		int[] nums = null;
    1401 		IGenericDao dao = null;
    1402 		try {
    1403 			dao = createDao(conn);
    1404 			nums = dao.updateBatch(objectMappingKey, objects);
    1405 		} catch (Exception e) {
    1406 			throw new DAOException(e);
    1407 		}
    1408 		return nums;
    1409 	}
    1410
    1411
    1412 	/***
    1413 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatchByPrimaryKeys(java.util.Collection,
    1414 	 *      java.util.Collection)
    1415 	 */
    1416 	public int[] updateBatchByPrimaryKeys(Collection objects,
    1417 			Collection oldPrimaryKeys) throws PersistenceException {
    1418 		int[] nums = null;
    1419 		IGenericDao dao = null;
    1420 		try {
    1421 			dao = createDao();
    1422 			nums = dao.updateBatch(objects, oldPrimaryKeys);
    1423 		} catch (Exception e) {
    1424 			throw new DAOException(e);
    1425 		} finally {
    1426 			JdbcUtil.close(dao);
    1427 		}
    1428 		return nums;
    1429 	}
    1430
    1431 	/***
    1432 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatchByPrimaryKeys(java.sql.Connection, java.util.Collection, java.util.Collection)
    1433 	 */
    1434 	public int[] updateBatchByPrimaryKeys(Connection conn, Collection objects,
    1435 			Collection oldPrimaryKeys) throws PersistenceException,
    1436 			DAOException {
    1437 		int[] nums = null;
    1438 		IGenericDao dao = null;
    1439 		try {
    1440 			dao = createDao(conn);
    1441 			nums = dao.updateBatch(objects, oldPrimaryKeys);
    1442 		} catch (Exception e) {
    1443 			throw new DAOException(e);
    1444 		}
    1445 		return nums;
    1446 	}
    1447
    1448 	/***
    1449 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatchByPrimaryKeys(java.lang.Object,
    1450 	 *      java.util.Collection, java.util.Collection)
    1451 	 */
    1452 	public int[] updateBatchByPrimaryKeys(Object objectMappingKey,
    1453 			Collection objects, Collection oldPrimaryKeys)
    1454 			throws PersistenceException {
    1455 		int[] nums = null;
    1456 		IGenericDao dao = null;
    1457 		try {
    1458 			dao = createDao();
    1459 			nums = dao.updateBatchByPrimaryKeys(objectMappingKey, objects, oldPrimaryKeys);
    1460 		} catch (Exception e) {
    1461 			throw new DAOException(e);
    1462 		} finally {
    1463 			JdbcUtil.close(dao);
    1464 		}
    1465 		return nums;
    1466 	}
    1467
    1468 	/***
    1469 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateBatchByPrimaryKeys(java.sql.Connection, java.lang.Object, java.util.Collection, java.util.Collection)
    1470 	 */
    1471 	public int[] updateBatchByPrimaryKeys(Connection conn,
    1472 			Object objectMappingKey, Collection objects,
    1473 			Collection oldPrimaryKeys) throws PersistenceException,
    1474 			DAOException {
    1475 		int[] nums = null;
    1476 		IGenericDao dao = null;
    1477 		try {
    1478 			dao = createDao(conn);
    1479 			nums = dao.updateBatchByPrimaryKeys(objectMappingKey, objects, oldPrimaryKeys);
    1480 		} catch (Exception e) {
    1481 			throw new DAOException(e);
    1482 		}
    1483 		return nums;
    1484 	}
    1485
    1486
    1487 	/***
    1488 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateByPrimaryKey(java.lang.Object,
    1489 	 *      java.lang.Object, java.lang.Object)
    1490 	 */
    1491 	public int updateByPrimaryKey(Object objectMappingKey, Object object,
    1492 			Object oldPrimaryKeyValue) throws PersistenceException {
    1493 		int nums = 0;
    1494 		IGenericDao dao = null;
    1495 		try {
    1496 			dao = createDao();
    1497 			nums = dao.updateByPrimaryKey(objectMappingKey,object, oldPrimaryKeyValue);
    1498 		} catch (Exception e) {
    1499 			throw new DAOException(e);
    1500 		} finally {
    1501 			JdbcUtil.close(dao);
    1502 		}
    1503 		return nums;
    1504 	}
    1505
    1506 	/***
    1507 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateByPrimaryKey(java.sql.Connection, java.lang.Object, java.lang.Object, java.lang.Object)
    1508 	 */
    1509 	public int updateByPrimaryKey(Connection conn, Object objectMappingKey,
    1510 			Object object, Object oldPrimaryKeyValue)
    1511 			throws PersistenceException, DAOException {
    1512 		int nums = 0;
    1513 		IGenericDao dao = null;
    1514 		try {
    1515 			dao = createDao(conn);
    1516 			nums = dao.updateByPrimaryKey(objectMappingKey, object, oldPrimaryKeyValue);
    1517 		} catch (Exception e) {
    1518 			throw new DAOException(e);
    1519 		}
    1520 		return nums;
    1521 	}
    1522
    1523
    1524 	/***
    1525 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateByPrimaryKey(java.lang.Object,
    1526 	 *      java.lang.Object)
    1527 	 */
    1528 	public int updateByPrimaryKey(Object object, Object oldPrimaryKeyValue)
    1529 			throws PersistenceException {
    1530 		int nums = 0;
    1531 		IGenericDao dao = null;
    1532 		try {
    1533 			dao = createDao();
    1534 			nums = dao.updateByPrimaryKey(object, oldPrimaryKeyValue);
    1535 		} catch (Exception e) {
    1536 			throw new DAOException(e);
    1537 		} finally {
    1538 			JdbcUtil.close(dao);
    1539 		}
    1540 		return nums;
    1541 	}
    1542
    1543 	/***
    1544 	 * @see org.huihoo.jfox.soaf.services.persistence.MrPersisterService#updateByPrimaryKey(java.sql.Connection, java.lang.Object, java.lang.Object)
    1545 	 */
    1546 	public int updateByPrimaryKey(Connection conn, Object object,
    1547 			Object oldPrimaryKeyValue) throws PersistenceException,
    1548 			DAOException {
    1549 		int nums = 0;
    1550 		IGenericDao dao = null;
    1551 		try {
    1552 			dao = createDao(conn);
    1553 			nums = dao.updateByPrimaryKey(object, oldPrimaryKeyValue);
    1554 		} catch (Exception e) {
    1555 			throw new DAOException(e);
    1556 		}
    1557 		return nums;
    1558 	}
    1559 }