[hibernate-dev] ORM5 : Reusing the Configuration instance

Hardy Ferentschik hardy at hibernate.org
Tue Mar 17 10:48:13 EDT 2015


On Mon, Mar 16, 2015 at 09:21:33PM +0000, Sanne Grinovero wrote:
> > given that the SessionFactory gets closed after each test, I think it would
> > only be fair to also rebuild the Configuration on each test set-up.
> > What is the reason for keeping it around anyways? Do the tests run
> > considerably slower when re-building the Configuration for each test?
> I'm not sure, git is pointing to your name :-) See:
> org.hibernate.search.test.TestResourceManager

Sure, I remember changing and refactoring the test base class quite often.
However, the re-use of the Configuration is something which has been in the code
as long as I remember. 

> It probably grew a bit of complexity over time and while I'm not sure
> of what the original intention could be, I tend to agree with the
> basic idea

That the Configuration should be re-usable?

> Even if we probably won't win much in terms of performance /
> practicality and we were to agree to simplify this, the following
> message is confusing:
> java.util.ServiceConfigurationError:
> org.hibernate.service.spi.ServiceContributor: Provider
> org.hibernate.search.hcore.impl.SearchFactoryServiceContributor not
> found
>      at java.util.ServiceLoader.fail(ServiceLoader.java:231)
>      at java.util.ServiceLoader.access$300(ServiceLoader.java:181)
>      at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:365)
>      at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
>      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:339)
>      at org.hibernate.boot.registry.StandardServiceRegistryBuilder.applyServiceContributors(StandardServiceRegistryBuilder.java:319)
>      at org.hibernate.boot.registry.StandardServiceRegistryBuilder.build(StandardServiceRegistryBuilder.java:296)
>      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:740)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 496 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20150317/cfe272d0/attachment.bin 

More information about the hibernate-dev mailing list