Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java @ 308:084995dd1c9c
Added a session holder to hold hibernate sessions.
flys-artifacts/trunk@1689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 14 Apr 2011 12:08:47 +0000 |
parents | e8dfe6ba2000 |
children | ea3a438a7021 |
comparison
equal
deleted
inserted
replaced
307:84f8462790cb | 308:084995dd1c9c |
---|---|
24 * Returns all rivers that were found in the backend. | 24 * Returns all rivers that were found in the backend. |
25 * | 25 * |
26 * @return all rivers. | 26 * @return all rivers. |
27 */ | 27 */ |
28 public static List<River> getRivers() { | 28 public static List<River> getRivers() { |
29 SessionFactory sf = SessionFactoryProvider.getSessionFactory(); | 29 Session session = SessionHolder.HOLDER.get(); |
30 Session session = sf.openSession(); | 30 return (List<River>)session |
31 try { | 31 .createQuery("from River order by name").list(); |
32 return (List<River>)session | |
33 .createQuery("from River order by name").list(); | |
34 } | |
35 finally { | |
36 session.close(); | |
37 } | |
38 } | 32 } |
39 } | 33 } |
40 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 34 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |