Entity bean bloat

I’m currently getting acquainted with JBoss, SpringSource Application Platform, JBoss Seam and Spring Framework.

One thing that amazes me is the amount of code required for some simple O/R mapping, or I am missing something? I hope to be wrong about this, but it seems like an EJB3 "entity bean" requires, for each column in a database, the following items written and maintained:

  • a private member variable
  • a getter method
  • a setter method

As I have some Ruby on Rails experience, where inheriting from ActiveRecord gives you those things out-of-the-box, I am amazed of the sheer amount of boilerplate code needed in Java for the same thing! I asked a friend wih ZendFramework knowledge about how it worked there, and it seems like Zend_Db_Table_Abstract works just like ActiveRecord.

I can’t be the first one perplexed by this, especially not when the development guide for the ASM 3.0 Java bytecode engineering library contains exactly the above parts as an example of generating bytecode! (See section 3.1.3.)

Leave a Reply

Your email address will not be published. Required fields are marked *