Skip to content
Advertisement

Tag: hibernate

Hibernate startup very slow

For some reason, the startup of my hibernate application is unbarrably slow. (up to 2 min) I have been thinking that the c3p0 configuration is plain wrong (related question) but studying the logs shows, that there is no activity just after the connection to the server is established. Also, using the built-in polling capabilities of Hibernate shows the same result.

Initializing C3P0 connection pool takes 2 min

I can’t wrap my head around why the initialization of a c3p0 connection pool takes 2 min in my Hibernate application. This is in my Hibernate.cfg.xml: The connection settings are set in my HibernateUtil file when building the session factory. The pool is initialize when the first transaction in my tests is openend. Connecting and querying the db works just

How to create entity classes using database for all the existing tables?

I am having tables created by a DBA and I intend to have entity classes for each table for further querying. Can any one suggest how to automatically create the entity classes using Eclipse? Answer If you use JPA for persistence, you can use “JPA tools” provided by Eclipse to generate java entity class from tables. Here is the [tutorial][1]

Why do I need Transaction in Hibernate for read-only operations?

Why do I need Transaction in Hibernate for read-only operations? Does the following transaction put a lock in the DB? Example code to fetch from DB: Can I use session.close() instead of tx.commit()? Answer Transactions for reading might look indeed strange and often people don’t mark methods for transactions in this case. But JDBC will create transaction anyway, it’s just

JPA could not locate named parameter

I keep getting the following error: “could not locate named parameter [articleCommentId]” but it doesn’t make sense to me because to me the named parameter is very much in place. Here is an extract of the stack trace with the relevant error: Answer I bet it is due to the extra ; in your query string. SQL/HQL does not need

Making Spring 3 MVC controller method Transactional

I am using Spring 3.1 and have my DAO and service layer(transactional) written. However in a special case to avoid a lazy init exception I have to make a spring mvc request handler method @transactional. But It is failing to attach transaction to that method. Method name is ModelAndView home(HttpServletRequest request, HttpServletResponse response). http://forum.springsource.org/showthread.php?46814-Transaction-in-MVC-Controller From this link it seems it

Advertisement