Rev 2001 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2001 | Rev 2029 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | import org.apache.log4j.Logger; |
4 | import org.apache.log4j.Logger; |
5 | import org.hibernate.Session; |
5 | import org.hibernate.Session; |
6 | import org.hibernate.SessionFactory; |
6 | import org.hibernate.SessionFactory; |
7 | import org.hibernate.cfg.Configuration; |
7 | import org.hibernate.cfg.Configuration; |
- | 8 | import org.hibernate.proxy.HibernateProxy; |
|
8 | 9 | ||
9 | public class HibernateUtils { |
10 | public class HibernateUtils { |
10 | 11 | ||
11 | // private static Session session; |
12 | // private static Session session; |
12 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(HibernateUtils.class); |
13 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(HibernateUtils.class); |
Line 59... | Line 60... | ||
59 | // examples = sessionFactory.openSession(); |
60 | // examples = sessionFactory.openSession(); |
60 | // return examples; |
61 | // return examples; |
61 | return getSessionFactory().getCurrentSession(); |
62 | return getSessionFactory().getCurrentSession(); |
62 | } |
63 | } |
63 | 64 | ||
- | 65 | /** |
|
- | 66 | * |
|
- | 67 | * @param o |
|
- | 68 | * @return |
|
- | 69 | */ |
|
- | 70 | public static 5+0%2Fdocs%2Fapi+Object">Object narrow(5+0%2Fdocs%2Fapi+Object">Object o) |
|
- | 71 | { |
|
- | 72 | if(o == null) |
|
- | 73 | return null; |
|
- | 74 | ||
- | 75 | if (o instanceof HibernateProxy) |
|
- | 76 | { |
|
- | 77 | return ((HibernateProxy)o).getHibernateLazyInitializer().getImplementation(); |
|
- | 78 | } |
|
- | 79 | ||
- | 80 | return o; |
|
- | 81 | } |
|
- | 82 | ||
- | 83 | ||
64 | } |
84 | } |