TL;DR Hibernate's (3.2-3.4) JPA implementation will pick up hbm files on it's own when it should be looking only at persistence.xml, thus: - loading more entities that it should - loading the wrong entities - performing schema updates in the wrong database This one annoyed me plenty and took a great deal of debugging to … Continue reading LocalContainerEntityManagerFactoryBean, Hibernate and superflous tables created in wrong database
Category: jpa
java.lang.NoClassDefFoundError: org/apache/openjpa/enhance/PersistenceCapable
My current project is using JPA, heavily. JPA is a spec/standard/interface and I'm using the Hibernate implementation for it, but I import the entities from a different maven module. The entities module has a dependency on JPA, but not on Hibernate. So when I run my unit tests, I suddenly get a: java.lang.NoClassDefFoundError: org/apache/openjpa/enhance/PersistenceCapable Openjpa? … Continue reading java.lang.NoClassDefFoundError: org/apache/openjpa/enhance/PersistenceCapable
On JPA identifiers and business keys (or why business keys are a bad idea)
JPA, and for that matter Hibernate, depends on identifying entity instances (I'll refer to them as entities for short) by some key. That key can either be a single property (like a numeric ID column in the corresponding table) or a business key (also referred to as natural key). Business keys are entity properties which … Continue reading On JPA identifiers and business keys (or why business keys are a bad idea)
Tomcat, Spring and memory leaks when undeploying or redeploying an web application
In this post I'll talk about a new kind of memory leak in Spring applications involving transaction management and initializing beans. About memory leaks when undeploying a web application While developing a web application with Spring and Tomcat I frequently run out of heap space. The web is full of stories about this. There is … Continue reading Tomcat, Spring and memory leaks when undeploying or redeploying an web application
JPA and postgres transaction isolation
The short story: the default Postgres transaction isolation level can lead to trouble in a web application. I'm showing here a way to change it in a Spring/JPA application. The long story: One of the applications I worked recently on consists of a rich client which issues an HTTP request for every little thing it … Continue reading JPA and postgres transaction isolation