diff --git a/docker/vcr-local-dev/docker-compose.yml b/docker/vcr-local-dev/docker-compose.yml index 1f9862f8..dc3667d2 100644 --- a/docker/vcr-local-dev/docker-compose.yml +++ b/docker/vcr-local-dev/docker-compose.yml @@ -1,21 +1,21 @@ version: '3' services: - webapp : - image: registry.gitlab.com/clarin-eric/docker-alpine-supervisor-java-tomcat-base:2.0.3 - environment: - - "CATALINA_OPTS=-Djava.security.egd=file:/dev/urandom" - ports: - - 8080:8080 - volumes: - - ../..:/app/src - - ./conf/vcr/vcr-admin.conf:/conf/vcr-admin.conf - - ./conf/vcr/pidproviders.properties:/conf/pidproviders.properties - - ./conf/tomcat/vcr-context.xml:/srv/tomcat8/conf/Catalina/localhost/ROOT.xml - - ./conf/tomcat/tomcat-users.xml:/srv/tomcat8/conf/tomcat-users.xml - - ./conf/fluentd/vcr.conf:/etc/fluentd/conf.d/vcr.conf -# - ./conf/server.jks:/cert/server.jks - networks: - - vcr +# webapp : +# image: registry.gitlab.com/clarin-eric/docker-alpine-supervisor-java-tomcat-base:2.0.3 +# environment: +# - "CATALINA_OPTS=-Djava.security.egd=file:/dev/urandom" +# ports: +# - 8080:8080 +# volumes: +# - ../..:/app/src +# - ./conf/vcr/vcr-admin.conf:/conf/vcr-admin.conf +# - ./conf/vcr/pidproviders.properties:/conf/pidproviders.properties +# - ./conf/tomcat/vcr-context.xml:/srv/tomcat8/conf/Catalina/localhost/ROOT.xml +# - ./conf/tomcat/tomcat-users.xml:/srv/tomcat8/conf/tomcat-users.xml +# - ./conf/fluentd/vcr.conf:/etc/fluentd/conf.d/vcr.conf +## - ./conf/server.jks:/cert/server.jks +# networks: +# - vcr database: image: "mariadb:10.3.10-bionic" diff --git a/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/VirtualColletionRegistryOAIRepository.java b/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/VirtualColletionRegistryOAIRepository.java index b34e0ce1..cda269cd 100644 --- a/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/VirtualColletionRegistryOAIRepository.java +++ b/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/VirtualColletionRegistryOAIRepository.java @@ -286,19 +286,18 @@ public RecordList getRecords(String prefix, Date from, Date until, if ((vcs != null) && !vcs.isEmpty()) { List records = new ArrayList(vcs.size()); for (VirtualCollection vc : vcs) { - records.add(createRecord(vc, headerOnly)); - /* - * XXX: force fetching of creators. - */ - vc.getCreators().size(); - /* - * XXX: force fetching of resources in case of "cmdi" - * prefix. + * Force fetching of creators, keywords and resources which + * are defined with lazy loading. This avoids the + * org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role .... no Session + * exception. */ - if ("cmdi".equals(prefix) && !headerOnly) { - vc.getResources().size(); - } + vc.getCreators().size(); + vc.getKeywords().size(); + vc.getResources().size(); + + records.add(createRecord(vc, headerOnly)); + } boolean hasMore = (offset + vcs.size()) < count; return new RecordList(records, offset, hasMore, (int) count);