# HG changeset patch # User mschaefer # Date 1544535636 -3600 # Node ID 3dfcb6e1c4d682797bc6c73eb137041a58c78b6a # Parent ca19b718629455bf16747541dcac59433b53e91d Use of SessionHolder replaced by ImporterSession if query executed in the importer diff -r ca19b7186294 -r 3dfcb6e1c4d6 backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/CollisionParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/CollisionParser.java Tue Nov 13 13:02:00 2018 +0100 +++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/CollisionParser.java Tue Dec 11 14:40:36 2018 +0100 @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import org.dive4elements.river.importer.Config; import org.dive4elements.river.importer.ImportRiver; +import org.dive4elements.river.importer.ImporterSession; import org.dive4elements.river.importer.common.AbstractParser; import org.dive4elements.river.importer.common.ParsingState; import org.dive4elements.river.importer.sinfo.importitem.CollisionKmLineImport; @@ -76,7 +77,7 @@ public CollisionParser(final File importPath, final File rootRelativePath, final ImportRiver river) { super(importPath, rootRelativePath, river); this.types = new HashMap<>(); - for (final CollisionType type : CollisionType.getTypes()) + for (final CollisionType type : CollisionType.getTypes(ImporterSession.getInstance().getDatabaseSession())) this.types.put(type.getName().trim().toLowerCase(), new CollisionTypeImport(type.getName())); } diff -r ca19b7186294 -r 3dfcb6e1c4d6 backend/src/main/java/org/dive4elements/river/model/sinfo/CollisionType.java --- a/backend/src/main/java/org/dive4elements/river/model/sinfo/CollisionType.java Tue Nov 13 13:02:00 2018 +0100 +++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/CollisionType.java Tue Dec 11 14:40:36 2018 +0100 @@ -74,8 +74,10 @@ /** * Queries all collision types from the database, orders by name */ - public static List getTypes() { - final Session session = SessionHolder.HOLDER.get(); + public static List getTypes(final Session session) { + Session session1 = session; + if (session1 == null) + session1 = SessionHolder.HOLDER.get(); final Query query = session.createQuery("FROM CollisionType ORDER BY name"); return new ArrayList<>(query.list()); }