JSR-308 and the Checker Framework Add Even More Typesafety to jOOQ 3.9

Java 8 introduced JSR-308, which added new annotation capabilities to the Java language. Most importantly: Type annotations. It is now possible to design monsters like the below: https://twitter.com/lukaseder/status/711612663202238464 The code displayed in that tweet really compiles. Every type can be annotated now, in order to enhance the type system in any custom way. Why, you … Continue reading JSR-308 and the Checker Framework Add Even More Typesafety to jOOQ 3.9

Use JUnit’s expected exceptions sparingly

Sometimes, when we get pull requests for jOOQ or our other libraries, people change the code in our unit tests to be more "idiomatic JUnit". In particular, this means that they tend to change this (admittedly not so pretty code): @Test public void testValueOfIntInvalid() { try { ubyte((UByte.MIN_VALUE) - 1); fail(); } catch (NumberFormatException e) … Continue reading Use JUnit’s expected exceptions sparingly

How JPA 2.1 has become the new EJB 2.0

Beauty lies in the eye of the beholder. So does "ease": https://twitter.com/thjanssen123/status/588212182225039361 Thorben writes very good and useful articles about JPA, and he's recently started an excellent series about JPA 2.1's new features. Among which: Result set mapping. We can summarise this mapping procedure as follows: a) define the mapping @SqlResultSetMapping( name = "BookAuthorMapping", entities … Continue reading How JPA 2.1 has become the new EJB 2.0

Annotatiomania™ 2.1

It's been a while since I have last ranted about annotations and the increasing Annotatiomania™ in the JEE ecosystem. I haven't been exposed to much JEE either, until yesterday, when I was confronted with an awesome talk by Adam Bien at ch-open, where I've also held a talk about jOOQ. JEE 7 ships with lots … Continue reading Annotatiomania™ 2.1

Next stop on the Annotatiomania™ Train: FetchGroups

Here's how an Annotatiomaniac™ can optimise his second-level cached JPA queries conveniently by adding yet more annotations (what else?) to his simple and plain POJO's. Remember that EJB 3.0 was about removing dependencies from javax.ejb.EJBObject, javax.ejb.EJBHome and similar interfaces? Well... check out this example: import org.apache.openjpa.persistence.*; @Entity @FetchGroups({ @FetchGroup(name="detail", attributes={ @FetchAttribute(name="publisher"), @FetchAttribute(name="articles") }), ... }) … Continue reading Next stop on the Annotatiomania™ Train: FetchGroups

Annotatiomania™, next level. JPA and JAXB combined

This is a very nice specimen of annotatiomania in the wild. When people not only confuse OO with relational, but also with XML. The "OOXMLational" model class, so to speak. Check this out: @Entity @Table(name = "Person", catalog = "TestDB", schema = "dbo") @XmlRootElement @NamedQueries({ @NamedQuery( name = "Person.findAll", query = "SELECT p FROM Person … Continue reading Annotatiomania™, next level. JPA and JAXB combined

Annotatiomania™ in Struts 2.0

I have to admit, I have not made any experience with Struts 1.0. Neither with 2.0. From what I understand, Struts 2.0 tried to move away from XML to use annotations instead. Just like Hibernate/JPA did. They have published Struts 2.0 with this title: "Apache Struts 2 is an elegant, extensible framework for building enterprise-ready … Continue reading Annotatiomania™ in Struts 2.0

Annotatiomania™, or why did Hibernate/JPA get so complex?

I was curious about good answers to this question on Stack Overflow: http://stackoverflow.com/questions/7332904/how-to-store-a-collection-of-dates-in-hibernate And a good answer came up, pointing at this Hibernate documentation page: http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-ofvalues Is anyone out there actually willing to mess around with gazillions of annotations on simple methods? Who ever writes this stuff: @Entity public class User { [...] public String … Continue reading Annotatiomania™, or why did Hibernate/JPA get so complex?