views:

460

answers:

5

Hi All,

I am a newbie to Java Web Application development. So far all I have used are plain old servlets, jdbc and jsps. I started to read about all the frameworks and I am totally confused and lost in the swarm of frameworks? So here are some questions I have:

  1. Are EJB3 and Hibernate competing technologies or can they be used together.
  2. If I used JBoss Seam, do I still need to use Hibernate for my ORM needs or Seam + EJB3 takes care of that?
  3. What are the typical frameworks I will need to learn if I have to develop a webapp using JBoss Seam? Is it some or all of the following: Seam (ofcourse) JSF EJB3 Hibernate Spring Inversion of control container
  4. Can I use JBoss Seam to develop an application on JBoss Portal?

thanks Vikas

+2  A: 

1. Are EJB3 and Hibernate competing technologies or can they be used together.

They have competing APIs (JPA is different from Hibernate's API) but Hibernate can be plugged in underneath JPA, just don't expect interoperability with things coded for Hibernate - notably jBPM (3.2) does not entirely interoperate even under Seam (2.1.1).

2. If I used JBoss Seam, do I still need to use Hibernate for my ORM needs or Seam + EJB3 takes care of that?

As I understabnd it, you can do either.

3. What are the typical frameworks I will need to learn if I have to develop a webapp using JBoss Seam? Is it some or all of the following: Seam (ofcourse) JSF EJB3 Hibernate Spring Inversion of control container

JSF - essential for Seam to really make sense afaict - I recommend focusing on facelets as a primary way of creating JSF pages. The syntax is nice and familiar - plain old namespace qualified XHTML with server side components sitting within separate namespaces. Utterly trivial and clean, unlike pretty much anything else I've tried.

EJB3 - if you like, or not, up to you. Heading this way drags you into Java EE which still scares me a little, though it has many benefits.

Hibernate - if you like, up to you. JPA entity managers provide the alternative.

Spring IoC, er... yeah sure if you like, again its up to you. Seam takes care of stateful session and conversation scoped beans (generally part of your presentation logic tier) and Spring is best for the stateless context, such as interfaces to back end services such as databases and any SOA clients.

I've found Seam + JSF (facelets) + Hibernate + Spring to be quite a good combination for creating UIs over jBPM and also on another project for delivering content pages, though that is not really what Seam is for.

  1. Can I use JBoss Seam to develop an application on JBoss Portal?

Sorry, can't help you there.

Simon Gibbs
A: 
  1. Yes and no. EJB3 (or rather JPA) is a specification for declaring OR mappings via Java5 annotations, and for interfaces to query them. You still need an implementation. Hibernate Annotations would be an implementation of the mapping, and Hibernate EntityManager is an implementation of the query interfaces - they use the "main" Hibernate to do their work. You should be able to mix and match those - it's possible to use JPA annotations, and use Hibernate's APIs like HQL and Criteria.
  2. Depends, mostly on the appserver. A full-featured application server could deal with the JPA stuff for you and you'd configure things through web.xml and the appserver console. Of course, that excludes mix-and-match. You can still roll your own regardless of the appserver though, accessing the query API programatically / using Spring / whatever.
  3. JSF is a prerequisite for using Seam. As for EJB3/JPA versus Hibernate - matter of preference. You don't really need to know much / any Hibernate to use it as a JPA implementation. JPA is strongly based on Hibernate's APIs, so the difference is likely to be fairly small either way. Spring is not strictly necessary, JBoss is trying its darnedest to get some of its market share with Web Beans. Some features of Seam overlap with some features of Spring. Spring is highly modular though and covers a lot, so you should be able to cherrypick Spring features you want.
  4. Wouldn't know.
Sii
A: 

JBoss Seam is a meta-framework that combines the EJB3 and JSF frameworks, and wraps them with a form of dependency injection. As a J2EE technology, you usually deploy it inside an application server - this is where JBoss Portal comes in.

JBoss Portal is a commercial offering from the JBoss organisation. It bundles various J2EE components together in the form of "modules", These components will include EJB3, JSF, and the JBoss Application Server.

Check out this link, and scroll to the bottom to find out where Seam and Portal fit together. The Portal site describes the modules that it provides (I assume there is a pricing model attached to them), Seam support is provided by the Portlet module.

seanhodges
A: 
  1. EJB3 and Hibernate are complementing technologies. EJB3 defines JPA (API) and Hibernate can be used as persistence provider for JPA.

  2. You still need to use one of persistence providers which could be Hibernate, OpenJPA, etc.

  3. JSF and EJB3.

  4. Regarding Seam and Portal development: better question would be is how well JSF and Portal work together?

They do work together of course - here is relevant tutorial: Developing Portlets using JSF, Ajax, and Seam

grigory
A: 

Regarding question #4.

JBoss Seam can be used inside of JBoss Portal if a bridge is used.

There is currently a JBoss Portlet Bridge project that is in CR stage and approaching release.

tschaible