• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EJB 3.0 + EntityManager or Spring

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Just wondering the trend of JEE5 projects these days w.r.t to application framework. With the EntityManager interface , JEE5 itself is easily configurable for persistence.
Also the annotations has made life simple with EJB3.0. Is there a need to go for Hibernate+Spring IOC if JEE5 provides these capabilities.?


Thanks in advance.

Regards,
Vinod Kumar

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

With the EntityManager interface , JEE5 itself is easily configurable for persistence


Yep. Persistence Unit and annotated POJOs are the equivalent to Hibernate config files and BOs, EntityManager takes the place of the Hibernate session. In fact, most of the classes in the javax.persistence package are annotations. But keep in mind that annotations are compiled, and config files are not. I would say that annotations are OK from the developer POV, but config files are better from the integration/test POV.

Is there a need to go for Hibernate+Spring IOC if JEE5 provides these capabilities.?


As usual, it depends on your needs...
Afaik, JEE5 injection (@PersistenceContext, @EJB...) works only in container managed classes (EJB, servlet...), so if you want to inject JEE dependencies in other types of resources, frameworks such as Spring are still usefull, and especially whith the Spring 2.5 JEE namespace: you can declare a local/remote ejb from a business interface in one line of XML.
With respect to persistence, you'll have to use a JPA engine (essentially the one of your AS), so if you use JBoss 5 AS, you're in fact using Hibernate for JPA under the hood (Glassfish uses EclipseLink...)
I would say stick with the JEE norm whenever you can, more importantly if your client want a full Sun (soon to be Oracle) JEE stack (code your application against JPA and not Hibernate).
Agreed, JPA 1.0 lacks some interesting features found in Hibernate (notably the Criteria API), but JPA 2.0 and JEE6 are not far and will address this.

My 0.02

Christian
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB 3 is certainly a handsome improvement from the past, but it doesn't exclude the need for a good framework like Spring.

I typically recommend JSF, EJB3 and Seam as a development platform, framework and philosophy. It's an easy sell to an architecture review board on a bank or insurance company. Smaller implementations might prefer something even more lightweight as there is a point where you get to 'framework-bloat.'

-Cameron McKenzie
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic