Quote:
The performance of my project is very important, because there are methods in some entity-classes which are called permanently with a rate of 300000 times per second.
The methods that are called frequently, do they require a database update/query too? If not, you will boost performance by using a detached instance of an entity. Meaning one retrieved from the database, but is not currently in a session (the session that got it was closed/cleared).
Quote:
My problem:
When I just create a SessionFactory, the performance of my programm decrease about 200%. (The CPU load increases about 200%)
Are you saying that your function which creates the configuration and the session factory is being called repeatedly?
Forgive me if I'm mistaken, the next paragraph of my post assumes that is what you're doing.
Your application should only create the configuration and the session factory once when the application starts. The process of initializing the configuration and session factory is very resource intensive. Keep a static reference to the result in a singleton style class. See an example here:
http://docs.jboss.org/hibernate/core/3. ... pp-helpersQuote:
Is it possible, that hibernate watches on any entity-classes for changes
It watches changes to entities that are contained in a session, aka persistent entities. Does not watch changes to transient or detached entities. For those that are persistent in a session though, it does not make database updates/queries unless it is necessary, or until the session's flush is reached. That is generally speaking though, I think there are ways to re-configure it (i.e. session.setFlushMode(...)). So long story short, simply modifying an entity through a setter method will not cause a database update/query.
Chapter 13 will answer some of your questions:
http://docs.jboss.org/hibernate/core/3. ... tions.htmlThis is another article that I think might answer your questions, and can help you with performance:
http://community.jboss.org/wiki/SessionsAndTransactions