How can I create SessionFactory after Hibernate upgrade?

In my Java SE application, I was using Hibernate 3.3.2 and it took about 5 seconds to create the SessionFactory.

I upgraded to Hibernate 3.5.1 today and suddenly it takes a minute.

What could be causing this dramatic effect?

I've tried different things for most of the day and I have no idea ...

Some data I have collected

  • According to the profiler, the most time is spent on PersisterFactory.createClassPersister

    and in this method it ProxyFactory.createClass

    takes the most time.
  • There is nothing unusual in the magazine
  • Change hibernate.bytecode.use_reflection_optimizer

    doesn't matter
+2


a source to share


2 answers


OK, this was absolutely stupid and had nothing to do with Hibernate at all, but I'll answer this question anyway, because it might prevent others from making the same mistakes.



  • SessionFactory creation in Hibernate 3.5 doesn't slow down.
  • There are thousands of method calls to initialize Hibernate when creating a SessionFactory.
  • Each of these method calls appears to create a small overhead for the profiler and debugger. Also, the JIT compiler is disabled during debugging.
  • The first time I noticed the slowness, I ran a one-step code and all subsequent tests ran using the profiler.
  • I just noticed that out of frustration, I just ran the application with no intentions to further fix the problem.
+1


a source


It has never hibernated 3.4. Hibernate 3.3.2 was the last public release before Hibernate 3.5



0


a source







All Articles