Revision 407dc559
Added by Andreas Müller over 16 years ago
cdmlibrary/src/main/java/eu/etaxonomy/cdm/persistence/dao/common/CdmEntityDaoBase.java | ||
---|---|---|
11 | 11 |
import org.hibernate.Query; |
12 | 12 |
import org.hibernate.Session; |
13 | 13 |
import org.hibernate.SessionFactory; |
14 |
import org.hibernate.Transaction; |
|
14 | 15 |
import org.hibernate.criterion.Order; |
15 | 16 |
import org.hibernate.criterion.Restrictions; |
16 | 17 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
public T findByUuid(String uuid) throws DataAccessException{ |
70 |
Criteria crit = getSession().createCriteria(type); |
|
71 |
Session session = getSession(); |
|
72 |
// logger.debug("BEGIN TRANSACTION"); |
|
73 |
// session.beginTransaction(); |
|
74 |
Transaction tx = session.getTransaction(); |
|
75 |
|
|
76 |
Criteria crit = session.createCriteria(type); |
|
71 | 77 |
crit.add(Restrictions.eq("uuid", uuid)); |
72 | 78 |
crit.addOrder(Order.desc("created")); |
73 | 79 |
List<T> results = crit.list(); |
80 |
// logger.debug("COMMIT TRANSACTION"); |
|
81 |
// tx.commit(); |
|
82 |
Object o = tx; |
|
74 | 83 |
if (results.isEmpty()){ |
75 | 84 |
return null; |
76 | 85 |
}else{ |
Also available in: Unified diff
first taxon in database