comparison flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java @ 5181:9d36ddf7dbd3

Change IllegalArgumentException to HibernateException.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 07 Mar 2013 10:44:27 +0100
parents 14d19313268a
children ae60bb7b8085
comparison
equal deleted inserted replaced
5180:520b4fea63bb 5181:9d36ddf7dbd3
105 throws IllegalArgumentException { 105 throws IllegalArgumentException {
106 return getRiverAxis(river, KIND_CURRENT); 106 return getRiverAxis(river, KIND_CURRENT);
107 } 107 }
108 108
109 public static List<RiverAxis> getRiverAxis(String river, int kind) 109 public static List<RiverAxis> getRiverAxis(String river, int kind)
110 throws IllegalArgumentException { 110 throws HibernateException {
111 Session session = SessionHolder.HOLDER.get(); 111 Session session = SessionHolder.HOLDER.get();
112 Query query = session.createQuery( 112 Query query = session.createQuery(
113 "from RiverAxis where river.name =:river AND kind.id =:kind"); 113 "from RiverAxis where river.name =:river AND kind.id =:kind");
114 query.setParameter("river", river); 114 query.setParameter("river", river);
115 query.setParameter("kind", kind); 115 query.setParameter("kind", kind);
116 116
117 try { 117 List<RiverAxis> list = query.list();
118 List<RiverAxis> list = query.list(); 118 return list.isEmpty() ? null : list;
119 return list.isEmpty() ? null : list;
120 }
121 catch (RuntimeException re) {
122 throw re.getCause();
123 }
124 } 119 }
125 } 120 }
126 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org