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 getLastname() { ...}

   @ElementCollection
   @CollectionTable(
      name="Addresses", 
      joinColumns=@JoinColumn(name="user_id"))
   @AttributeOverrides({
      @AttributeOverride(
         name="street1", 
         column=@Column(name="fld_street"))
   })
   public Set<Address> getAddresses() { ... }
}

@Embeddable
public class Address {
   public String getStreet1() {...}
   [...]
}

Do some developers despise SQL so much that they’re willing to put up with “annotatiomania”? Whatever happened with the good old

SELECT u.first_name, u.last_name, a.street1
FROM users u
JOIN addresses a ON a.user_id = u.id

Guys. If a technology starts doing things like “@AttributeOverrides”, then something IS smelling fishy

3 thoughts on “Annotatiomania™, or why did Hibernate/JPA get so complex?

  1. It is hard to argue against this post, but people will. They will say that annotation-programming is very easy and straightforward. It is our fault that we cannot understand or cope with annotations. These people were probably happy with Struts1. Or maybe not and now they are euphoric with Struts2. Check this: http://struts.apache.org/2.x/docs/validation-annotation.html

    Programmatic Configuration is the way to go. I have been fighting for this since 2005. Guice went that path. Spring has recently given up and started offering programmatic configuration as well. It is time for Hibernate4 with NO ANNOTATIONS and NO XML. But what is programmatic configuration? Some people don’t even know and think it is annotations. I must be insane to try to do something like this: http://www.mentaframework.org

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s