# HG changeset patch # User Sascha L. Teichmann # Date 1372349321 -7200 # Node ID 5910ada51a9f951abfcbd55cbc17bed63a281894 # Parent 25912df0facf5f4be58c5439980f892c0935d4d1 Reference only Q main values for official lines diff -r 25912df0facf -r 5910ada51a9f backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java --- 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; diff -r 25912df0facf -r 5910ada51a9f backend/src/main/java/org/dive4elements/river/model/NamedMainValue.java --- 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 named = query.list(); return named.isEmpty() ? null : named.get(0); }