Hibernate

Performance monitoring of a cloud deployment

An application go-live took a wrong turn - a dozen of connected clients took a cloud system down, that should cope with thousands of them. As I was assigned to analyze the problems I discovered that this is a composite problem created by (amongst other things) careless usage of Hibernate (an ORM framework for easier, vendor-agnostic database access) and way to much complex logic built 'into' the database - killing both the database and the web applications host by using up its CPU. After using Hibernate statistics for analyzing the transactions that are being sent to the database, I started by rewriting some SQL queries that didn’t perform well. Some complex Java/Hibernate logic even had a kind of memory leak in it which could be resolved by writing a single database stored procedure. A connectivity checking method for the clients was moved from saving ping data in the database to an efficient in memory solution using an in-memory data grid called Hazelcast. Nevertheless the CPU load stayed above an acceptable threshold. Using an application performance management tool I could find another root cause in a flawed function that was being called periodically. Looking at the CPU load graph one could see that the CPU went about each three minutes from under 10 to almost 100 percent. The load was created by one single thread with about 80% of network IO and 20% code execution, where multiple database calls were made, responses sorted and analized. Not only was the sorting flawed, also the database calls were being performed for all rows in one table and not just for a small subset of the entries. After a rewrite the CPU usage dropped to a single-digit percentage which kept the system in a healthy state.

use requires new for synchronous code that asynchronous code needs to access

the thread does not see the record because the test runs inside a transaction that is not committed yet. since the transaction is bound to the executing thread the task that is forked does not use the same transaction. in order for this to work the insert must run in a method that is annotated with @Transactional(propagation = REQUIRES_NEW). please note that transactional rollback will not work then though

CRUD operations example using Spring, MVC, Hybernate and Maven

I need an example to better understand of how to operate with these technologies. The interface will be HTML-based. The application will support all CRUD operations: create, read, update, delete. MySQL was used for the database.

Searching Entities with Hibernate Entity Manager

Actually it seems that I was working with an outdated version of Hibernate. In a new release from summer 2008 (Hibernate Entity Manager 3.4.0) they solved the problem, that entities could not be found when the path contained whitepaces, along with some other problems. Therefore the easy solution is to update your current Hibernate version to at least version 3.4.x.

Taggings:

Searching Entities with Hibernate Entity Manager

Hibernate is used to easily handle database operations in Java applications. It makes mapping between Java objects and the database a lot easier. It is also possible to use the persistence API (JPA) to store entities in databases. However, if you search for entities, that you want to use in your application, the path to those entities should not contain a whitespace. Otherwise you’ll get a “File not Found” – exception (this is not correct).
Subscribe to Hibernate