Generating Database Schemas with JPA 2.1


Prior JPA 2.1, most JPA providers (Hibernate, EclipseLink, OpenJPA) would have a proprietary way to generate the database schema (Data Definition Language scripts) from Entities. In the JPA 2.1 specification (JSR 338) there is a new section called 9.4 Schema Generation introducing an API and some properties to generate a database schema in a standard and portable way. Properties in persistence.xml In the […]

Read More →

WYTIWYR : What You Test Is What You Run


I'm fed up with unit testing !

It's 2012 and my first resolution of the year is to finally tell the truth about testing : unit testing is pretty much useless when your code runs inside a container. How do you unit test an EJB which relies on the container services (i.e transaction, injection, security...) ? Well, you mock the database access, you mock your security layer, you mock your dependencies, you mock your validation layer... to test what ? A bit of business logic. Yes. Unit test is interesting when you have complex business logic to test so you can have quick feedback. Otherwise, it's a waste of time which doesn't test your container services. So I'm not saying unit testing is completely useless, I'm saying that integration testing is also to be considered when you run your code inside a Java EE container.

Read More →