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)

ID trouble with multiple Hibernate entities on the same table

Just a while ago I ran into a case where Hibernate would auto generate a wrong database schema when two entities were mapped on the same table. The good news: it's my fault and not a bug. The better news: here's an account of how to avoid it. Let's assume a mutable entity A mapped … Continue reading ID trouble with multiple Hibernate entities on the same table