Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthColumn.java @ 9098:32dd7e761e4e
Fixed condition for Query.list result (checking isEmpty added)
author | mschaefer |
---|---|
date | Mon, 28 May 2018 10:56:57 +0200 |
parents | c16e90a0baf7 |
children |
comparison
equal
deleted
inserted
replaced
9097:82917e414d76 | 9098:32dd7e761e4e |
---|---|
120 public static FlowDepthColumn getColumnById(final int id) { | 120 public static FlowDepthColumn getColumnById(final int id) { |
121 final Session session = SessionHolder.HOLDER.get(); | 121 final Session session = SessionHolder.HOLDER.get(); |
122 final Query query = session.createQuery("FROM FlowDepthColumn WHERE id=:id"); | 122 final Query query = session.createQuery("FROM FlowDepthColumn WHERE id=:id"); |
123 query.setParameter("id", id); | 123 query.setParameter("id", id); |
124 final List<FlowDepthColumn> rows = query.list(); | 124 final List<FlowDepthColumn> rows = query.list(); |
125 return (rows != null) ? rows.get(0) : null; | 125 return ((rows != null) && !rows.isEmpty()) ? rows.get(0) : null; |
126 } | 126 } |
127 } | 127 } |