Introduction As previously explained, the TABLE identifier generator does not scale, so you should avoid id. However, some enterprise applications might need to run on both MySQL (which does not support database sequences), as well as Oracle, PostgreSQL and SQL Server 2012. This is article is going to explain how easily you can achieve this … Continue reading How to replace the TABLE identifier generator with either SEQUENCE or IDENTITY in a portable way →
Introduction I read a very interesting article by Krešimir Nesek regarding MySQL result set streaming when it comes to reducing memory usage. Mark Paluch, from Spring Data, asked if we could turn the MySQL result set streaming by default whenever we are using Query#stream or Query#scroll. That being said, the HHH-11260 issue was created, and … Continue reading How does MySQL result set streaming perform vs fetching the whole JDBC ResultSet at once →
Introduction This article is part of a series of posts related to calling various relational database systems stored procedures and database functions from Hibernate. The reason for writing this down is because there are many peculiarities related to the underlying JDBC driver support and not every JPA or Hibernate feature is supported on every relational … Continue reading How to call MySQL stored procedures and functions with JPA and Hibernate →
Recent Tips and News on Java, Java EE 6, GlassFish & more :
• Using Java Persistence API for Java SE 7
Desktop applications in NetBeans 7 (Oracle Learning
“I believe that one should benchmark before making any technology decisions.” An interview with Pieter van Zyl creator of the OO7J benchmark. In August last year, I published an interesting resource in ODBMS.ORG, the dissertation of Pieter van Zyl, from the University of Pretoria:“Performance investigation into selected object persistence stores”. The dissertation presented the OO7J [...]
Not so long ago, in a galaxy not very far away... a middle-aged
programmer battled to free memory from the dark side of the
hibernate query cache. He was successful, or so it seemed.
For the query cache memory problems had risen from the ashes --
stronger and more bloated than ever...
What's With All This Garbage?
We hit a case at work (again), where the java server process came to a grinding halt. It wasn't dead, it just wasn't making much forward progress either. A quick look at the heap stats showed we were nearly at capacity and that garbage collection was eating all CPU time, thus not allowing any real work to happen. Looks like it is time to whip out the ol' memory profiler. This time I went with Eclipse's Memory Analysis Tool . …
Red Hat increases its service levels. Linux Foundation appoints Ted Ts’o CTO. Sun delivers VirtualBox update. Novell cancels BrainShare. BBC enables iPlayer for Linux. And more.
Note: This is the last 451 CAOS Links post of 2008. We’ll be back with a bumper holiday special on January 2. Happy holidays!
Red Hat Increases Service Levels and Reduces Costs for Customers with Extended Update Support Red Hat
You Mean, Memory Is Not Infinite? We're working hard getting
MySQL Enterprise Monitor 2.0, featuring Query
Analyzer, ready for release. As part of that, we started
really ramping up the number of MySQL servers reporting in query
data to see how we could scale. Not surprising (to me, anyway),
the first efforts did not go so well. My old friend
OutOfMemoryError reared its ugly head once again.
Query Cache -- It's More Than Just Results! We're big (ab)users of hibernate query caching, and more importantly to us the natural id optimized query cache. Firing up the profiler, I was not shocked to see that the second level (let's call it L2) and query caches were hogging the majority of memory. But, something didn't smell right...
What I was seeing was tons of …
I work on the MySQL Enterprise Tools team, formerly of MySQL and now with
Microsystems. The 2.0 version of the Enterprise Monitor is
well under way. As part of this, the Java server backend has been
refactored to utilize Spring and Hibernate. Honestly, I didn't know either one
of those technologies before starting this project. Oh, what a
fun road it has been...
A big draw for using an off-the-shelf ORM was so that we didn't have to write our own (kind of bad and slightly wrong -- those darn transactions) caching implementations for the custom one-off ORM that existed previously. A lot of our internal meta-model is very static, so …
MySQL has a handy feature, that allows you to turn an INSERT into an UPDATE if a unique or primary key duplication is detected:
A common usage pattern for this is “lazy initialization“ of a row in a database, which is exactly what my team was using it for yesterday to solve a problem in the backend for version 2.0 of the MySQL Enterprise Monitor. However, we ran into an issue where Hibernate would throw an exception complaining that when the INSERT was turned into an UPDATE, it couldn‘t retrieve the generated primary key value (we are using auto increments on this particular table, as it‘s not a high insertion-rate table).
To understand why this happens, you have to know a little bit about how Statement.getGeneratedKeys() works with MySQL‘s JDBC driver. …[Read more]