Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was browsing through this talk about "Historically Bad Ideas" over the history of Computer Science, and found an interesting presentation about the rise & fall of the Java Enterprise initiatives. Slide #16 grabbed my attention by suggesting that Container Managed Persistence is a "naïve ORM solution". Of course, I assume the presenter made a live in-depth analysis of the problem, which is missing in the slide. So I was left intrigued by that statement. Is CMP Entity Beans just a heavy piece of naive engineering?

Aside any bias from the author(s) of the presentation, what would constitute a more adequate ORM solution in the domain of languages like Java or C#? I'm not asking for specific tools or frameworks, but better approaches. Thank you!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

In general a good ORM solution should be easy to use and understand. It should promote the use of good design patterns (DAOs, DTOs, lazy loading, services, transaction boundaries, ease of configuration etc). It should be non-invasive - that is, it should not force you to extend special classes or implement special interfaces.

The EJB specifications fell over a lot in the early days leading to the mass migration away to the likes of Spring and Hibernate. EJB1 failed to adequately define CMP fields on the bean, EJB2 sort of implied that they should be abstract accessors rather than actual fields, which was just odd, and it wasn't until EJB3 that something close to what everyone actually wanted was created. By then it was too late, everyone believed EJB sucked and it took the JPA and JTA JCRs to put things right again.

EJB1 and 2 generally forced the developer to put all their persistence configuration in a bunch of XML files well away from the actual code that was using it. This lead to lots of confusion and buggy code. Other ORM frameworks learned from this and decided to use annotations instead. Big win for them.

EJB1 and 2 had very limited support for different kinds of relationships and how they could be implemented in the underlying relational database. All kinds of special interfaces had to be adhered to and the resulting code was hard to fathom.

Anyway, all that is in the past and we can look forward to a bright future with the likes of Hibernate implementing JPA and JTA. All very harmonious.

share|improve this answer
    
Well worth the wait for an answer! –  Humberto Nov 8 '10 at 17:33
    
@Humberto No problems, glad to help. –  Gary Rowe Nov 8 '10 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.