I have problem with jax-rs REST service. Service does not operate properly. Every second request service throw me exception: HTTP Status 500 – could not execute query type Exception report message …
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]
How to prevent SQL Injection with JPA and Hibernate?
I am developing an application using hibernate. When I try to create a Login page, The problem of Sql Injection arises. I have the following code: How will i prevent Sql Injection in this scenario ?The create table syntax of loginInfo table is as follows: Answer You have other options too, see this nice article from mkyong.
Many to many with Hibernate and annotations for self referencing
My brain is starting to hurt thinking about this, is it as simple as: Answer Something like:
SQLDeveloper runs query but getting a “ORA-00979: Not a Group By expression” from hibernate
I have data that looks something like this: And a query that works fine in Oracle SQL Developer (It returns data averaged over 15 second periods): but when I plug it into my java code, I get an error: The actual query string I use in the Jave looks more like this: and the parameters are set by calling: Anyone
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