comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java @ 1897:cf8a376eb4c9

Fix and use SQL statement to fetch wst-names. flys-artifacts/trunk@3257 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Nov 2011 09:10:07 +0000
parents 1cf36ffe69b5
children 5642a83420f2
comparison
equal deleted inserted replaced
1896:2e2ca95459d2 1897:cf8a376eb4c9
39 "WHERE wst_id = :wst_id AND position = :column_pos"; 39 "WHERE wst_id = :wst_id AND position = :column_pos";
40 40
41 /** Query to get name (description) for wst_id. */ 41 /** Query to get name (description) for wst_id. */
42 public static final String SQL_SELECT_WST_NAME = 42 public static final String SQL_SELECT_WST_NAME =
43 "SELECT description from wsts "+ 43 "SELECT description from wsts "+
44 "WHERE wst_id = :wst_id"; 44 "WHERE id = :wst_id";
45 45
46 46
47 private WKmsFactory() { 47 private WKmsFactory() {
48 } 48 }
49 49
84 log.debug("WKmsFactory.getWKmsName wst_id/" + wst_id); 84 log.debug("WKmsFactory.getWKmsName wst_id/" + wst_id);
85 85
86 String name = null; 86 String name = null;
87 Session session = SessionHolder.HOLDER.get(); 87 Session session = SessionHolder.HOLDER.get();
88 88
89 SQLQuery nameQuery = session.createSQLQuery(SQL_SELECT_NAME) 89 SQLQuery nameQuery = session.createSQLQuery(SQL_SELECT_WST_NAME)
90 .addScalar("name", StandardBasicTypes.STRING); 90 .addScalar("description", StandardBasicTypes.STRING);
91 nameQuery.setInteger("wst_id", wst_id); 91 nameQuery.setInteger("wst_id", wst_id);
92 92
93 List<String> names = nameQuery.list(); 93 List<String> names = nameQuery.list();
94 if (names.size() >= 1) { 94 if (names.size() >= 1) {
95 name = names.get(0); 95 name = names.get(0);

http://dive4elements.wald.intevation.org