|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HibernateConfiguredTransactionStrategy | Line # 44 | 3 | 0% | 2 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(14) | |||
Result | |||
1.0
|
org.perfectjpattern.jee.integration.dao.spring.TestExample.testSpringGenericDao
![]() |
1 PASS | |
1.0
|
org.perfectjpattern.jee.integration.dao.hibernate.TestExample.testHibernateGenericDao
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericDao.testDelete
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericReadOnlyDao.testContains
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericReadOnlyDao.testFindAll
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericReadOnlyDao.testFindById
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericReadOnlyDao.testCount
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericDao.testUpdate
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestSpringGenericDao.testFindByExample
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestSpringGenericDao.testFindById
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericReadOnlyDao.testFindByExample
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestSpringGenericDao.testFindByName
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestSpringGenericDao.testFindByAge
![]() |
1 PASS | |
0.4
|
org.perfectjpattern.jee.integration.dao.TestHibernateGenericDao.testCreate
![]() |
1 PASS | |
1 | //---------------------------------------------------------------------- | |
2 | // | |
3 | // PerfectJPattern: "Design patterns are good but components are better!" | |
4 | // DefaultJSEDaoTransactionStrategy.java Copyright (c) 2009 Giovanni Azua Garcia | |
5 | // bravegag@hotmail.com | |
6 | // | |
7 | // This program is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU General Public License | |
9 | // as published by the Free Software Foundation; either version 3 | |
10 | // of the License, or (at your option) any later version. | |
11 | // | |
12 | // This program is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License | |
18 | // along with this program; if not, see <http://www.gnu.org/licenses/>. | |
19 | // | |
20 | //---------------------------------------------------------------------- | |
21 | package org.perfectjpattern.jee.integration.dao; | |
22 | ||
23 | import org.apache.commons.lang.*; | |
24 | import org.hibernate.*; | |
25 | import org.hibernate.transaction.*; | |
26 | import org.perfectjpattern.jee.api.integration.dao.*; | |
27 | ||
28 | /** | |
29 | * Concrete simple implementation of {@link ITransactionStrategy} corresponding | |
30 | * to {@link Session#getTransaction()} | |
31 | * <br/> | |
32 | * <br/> | |
33 | * This strategy is mandated by the Hibernate configuration value specified in | |
34 | * property <code>hibernate.transaction_factory</code>. If not specified, the | |
35 | * default value is {@link JDBCTransactionFactory}. | |
36 | * | |
37 | * Concrete simple implementation of {@link ITransactionStrategy} targeting | |
38 | * the JSE environment | |
39 | * | |
40 | * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a> | |
41 | * @version $Revision: 1.0 $Date: Feb 8, 2009 5:30:47 PM $ | |
42 | */ | |
43 | public final | |
44 | class HibernateConfiguredTransactionStrategy | |
45 | implements ITransactionStrategy | |
46 | { | |
47 | //------------------------------------------------------------------------ | |
48 | // public | |
49 | //------------------------------------------------------------------------ | |
50 | 8 |
![]() |
51 | HibernateConfiguredTransactionStrategy(ISessionStrategy aSessionStrategy) | |
52 | { | |
53 | 8 | Validate.notNull(aSessionStrategy, |
54 | "'aSessionStrategy' must not be null"); | |
55 | ||
56 | 8 | theSessionStrategy = aSessionStrategy; |
57 | } | |
58 | ||
59 | //------------------------------------------------------------------------ | |
60 | /** | |
61 | * {@inheritDoc} | |
62 | */ | |
63 | 59 |
![]() |
64 | getTransaction() | |
65 | { | |
66 | 59 | return theSessionStrategy.getSession().getTransaction(); |
67 | } | |
68 | ||
69 | //------------------------------------------------------------------------ | |
70 | // members | |
71 | //------------------------------------------------------------------------ | |
72 | private final ISessionStrategy theSessionStrategy; | |
73 | } |
|