Mercurial > dive4elements > river
changeset 6481:5910ada51a9f double-precision
Reference only Q main values for official lines
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 27 Jun 2013 18:08:41 +0200 |
parents | 25912df0facf |
children | 3b93f439e954 |
files | backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java backend/src/main/java/org/dive4elements/river/model/NamedMainValue.java |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java Wed Jun 26 21:22:37 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java Thu Jun 27 18:08:41 2013 +0200 @@ -45,7 +45,7 @@ // XXX: This is a bit odd. We do not have not enough infos here // to create a new NamedMainValue. So we just look for existing ones. Session session = ImporterSession.getInstance().getDatabaseSession(); - NamedMainValue nmv = NamedMainValue.fetchByName(name, session); + NamedMainValue nmv = NamedMainValue.fetchByNameAndType(name, "Q", session); if (nmv == null) { // failed -> failed to create OfficialLine return null;
--- a/backend/src/main/java/org/dive4elements/river/model/NamedMainValue.java Wed Jun 26 21:22:37 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/NamedMainValue.java Thu Jun 27 18:08:41 2013 +0200 @@ -90,10 +90,12 @@ this.officialLines = officialLines; } - public static NamedMainValue fetchByName(String name, Session session) { + public static NamedMainValue fetchByNameAndType( + String name, String type, Session session) { Query query = session.createQuery( - "from NamedMainValue where name=:name"); + "from NamedMainValue where name=:name and type.name = :type"); query.setString("name", name); + query.setString("type", type); List<NamedMainValue> named = query.list(); return named.isEmpty() ? null : named.get(0); }