Statistics
| Branch: | Revision:

m2u-upass-core / src / my / com / upass / dao / hibernate / UserMasterBackupDAOHibernate.java @ 0:02300db8682b

History | View | Annotate | Download (1.62 KB)

1
/**
2
 * Copyright (M) 2011 Penril Datability (M) Sdn Bhd All rights reserved.
3
 *
4
 * This software is copyrighted. Under the copyright laws, this software
5
 * may not be copied, in whole or in part, without prior written consent
6
 * of Penril Datability (M) Sdn Bhd or its assignees. This software is
7
 * provided under the terms of a license between Penril Datability (M)
8
 * Sdn Bhd and the recipient, and its use is subject to the terms of that
9
 * license.
10
 */
11

    
12
package my.com.upass.dao.hibernate;
13

    
14
import my.com.upass.dao.TbAmUsermasBackupDAO;
15
import my.com.upass.pojo.UserMasterBeanBackup;
16
import net.penril.generic.hibernate.GenericDAOHibernate;
17

    
18
import org.hibernate.Criteria;
19
import org.hibernate.HibernateException;
20

    
21
/**
22
 * 
23
 * PROGRAMMER: Danniell CHANGE-NO: TASK-NO: DATE CREATED: Aug 3, 2011 TAG AS:
24
 * REASON(S): MODIFICATION:
25
 */
26

    
27
public class UserMasterBackupDAOHibernate extends
28
                GenericDAOHibernate<UserMasterBeanBackup, Long> implements
29
                TbAmUsermasBackupDAO
30
{
31
        public UserMasterBeanBackup getTbAmUsermasBackupByUserId (Integer tUserId)
32
                        throws Exception
33
        {
34
                UserMasterBeanBackup TbAmUsermasBackup;
35
                try
36
                {
37
                        getSession ().beginTransaction ();
38

    
39
                        Criteria m_oCriteria = getSession ().createCriteria (
40
                                        UserMasterBeanBackup.class);
41
                        TbAmUsermasBackup = (UserMasterBeanBackup) m_oCriteria.uniqueResult ();
42

    
43
                        getSession ().getTransaction ().commit ();
44
                }
45
                catch (Exception e)
46
                {
47
                        if (e instanceof HibernateException)
48
                        {
49
                                getSession ().getTransaction ().rollback ();
50
                        }
51
                        throw e;
52
                }
53
                finally
54
                {
55
                        getSession ().close ();
56
                }
57
                return TbAmUsermasBackup;
58
        }
59
}