Back from a vacation from ‘im Don’t Be Afraid to Drop the SOAP
Oct 04

Lightweight containers vs. EJB: Don Box, Ted Neward, Rod Johnson, and more

EJB, Java, Lightweight Containers, Tech Add comments

A blog discussion has started on the subject of lightweight containers, and somehow changed to OR mappers at the end :)

Neward on Crupi

What is the state of the enterprise Java world, anyway?

I think there are some KEY differences with the recent move to lightweight containers.

The various tools that I seem to prefer these days have one thing in common:


I think this is a huge thing. I think that so many projects have gotten away from core OO practices (and OO doesn’t mean distributed objects Ted!) because they were stuck with crappy EJBs. These applications were built using “patterns” of:

Stateless Session Bean – Entity Beans – which use DTOs

This isn’t OO. This is RPC. The entity beans often had simple mapping, and don’t allow for inheritence. DTOs are evil as they are a duplicate layer of structs that you are throwing around.

Note that I am talking about an application that isn’t a service. I am talking about building an internal application first, using good OO practices, and THEN you can lay on the service layer to allow for external stuff.

So, back to transparency.

IoC Containers

I can finally write code that is just POJO based. There are no extension points to the framework. I am not stuck extended evil EJB interfaces and classes, having to create “home” interfaces and such. This all gets in the way. Not only does it get in the way but not I am totally tied up in knots.

With a container like Spring you look at my code and would have no idea if I am using it! What if I want to move to something else like Pico or Hivemind? I can. My core business logic is in tact and I can go about my way of moving. I don’t sit around crying because I have to munge my logic from the coupling with the framework! I love it.

JDO, Hibernate, etc

I like transparent persistence (not that it is truly transparent due to the OO-DB mismatch… but it gets close). Once again, I can develop a full, rich, domain object model. The model can even have inheritence and interfaces, and maybe people will put in real business methods that do things instead of just gets and sets (gasp!).

Now with a marriage of these technologies I have a clean domain object model (transparent persistence), and clean services (lightweight container). Testing IS a lot nicer too in my experience Ted. You don’t need to run around finding or building bloody mocks for the environment.


I do agree with Ted in that EJB is good for some things, such as 2PC and Message Driven Beans. There is going to be a kick arse way to do MDB in Spring coming up soon, so that need will go away. What about 2PC?

Well, a couple of things can happen:

a) The lightweight container can support them
b) You use an EJB when you need to do 2PC! One nice thing about the lightweight containers is that they can be used WITH EJB too :) However, HOW many applications need 2PC? 2%? And then within those applications, how many of their transactions need to be 2PC?

If you can’t see that Spring isn’t nicer than EJB? Ouch. You must like eating the elephant ;)

9 Responses to “Lightweight containers vs. EJB: Don Box, Ted Neward, Rod Johnson, and more”

  1. Don Box's Spoutlet Says:

    re: Neward on Crupi

  2. Dilip Says:

    “However, HOW many applications need 2PC? 2%? And then within those applications, how many of their transactions need to be 2PC?”

    Dion.. That statement above seems awfully backwards to me. An application decides whether it needs local or distributed transactions first. If it needs the latter then 2PC is a foregone conclusion. The real question you need to ask is whether running a distributed transaction is that prevelant. COM+ had this bad habit of starting a distributed transaction as soon as you declaratively mark a component as requiring transaction even if you operate on only one RM.

  3. Dion Says:

    Prashant -

    I agree with you there. Especially, now with JOTM, we have a solid open source JTA implementation that we haven’t had before.

    I just meant that EJB is an option with 2PC.

    I agree with you 100% though :)


  4. Heloise Says:

    freewebpages [url=]freewebpages[/url]
    free firewall softwares [url=]free firewall softwares[/url]
    asian massage parlor [url=]asian massage parlor[/url]
    download simcity 3000 [url=]download simcity 3000[/url]
    aolim download [url=]aolim download[/url]
    free gallery naturism [url=]free gallery naturism[/url]
    www miniclip ro [url=]www miniclip ro[/url]
    houston chronicle classifieds [url=]houston chronicle classifieds[/url]
    download music softwear [url=]download music softwear[/url] [url=][/url]
    clipart monkeys [url=]clipart monkeys[/url]
    rap video auditions [url=]rap video auditions[/url]
    border cliparts [url=]border cliparts[/url]
    free baby cliparts [url=]free baby cliparts[/url]
    comprehension worksheets free [url=]comprehension worksheets free[/url]
    free poncho patterns [url=]free poncho patterns[/url]
    trisha video clip download [url=]trisha video clip download[/url]
    free popup stoppers [url=]free popup stoppers[/url]
    cock info large massive remember [url=]cock info large massive remember[/url]
    soundmax downloads [url=]soundmax downloads[/url]
    freezers upright [url=]freezers upright[/url] [url=][/url]
    free region rj1500dvx [url=]free region rj1500dvx[/url]
    9 free grade grammar home school worksheets [url=]9 free grade grammar home school worksheets[/url]
    freedmen bureau [url=]freedmen bureau[/url]
    hairy pusy movie [url=]hairy pusy movie[/url]
    dxball download [url=]dxball download[/url]
    livewire music download free [url=]livewire music download free[/url]
    free calligraphy alphabet [url=]free calligraphy alphabet[/url] [url=][/url]

  5. Maxx Says:

    the spongebob squarepants movie big romance [url=]the spongebob squarepants movie big romance[/url]
    toms movie [url=]toms movie[/url]
    butterfly+screensaver [url=]butterfly+screensaver[/url]
    download fat man scoop [url=]download fat man scoop[/url]
    fulldvd marvel nemesis ps2 usa [url=]fulldvd marvel nemesis ps2 usa[/url]
    telugu song download [url=]telugu song download[/url]
    free musicc videos [url=]free musicc videos[/url]
    cassidy murder trial [url=]cassidy murder trial[/url]
    free printable kids chore charts [url=]free printable kids chore charts[/url]
    assman [url=]assman[/url]
    free printables for scrapbooking [url=]free printables for scrapbooking[/url]
    hallmark ecard free [url=]hallmark ecard free[/url]
    free jenna lewis video [url=]free jenna lewis video[/url]
    data1.msi downloads [url=]data1.msi downloads[/url]
    clipart footballs [url=]clipart footballs[/url]
    free patterns crochet baby blankets [url=]free patterns crochet baby blankets[/url]
    phim nguoi lon for free [url=]phim nguoi lon for free[/url]
    beginning exorcist movie [url=]beginning exorcist movie[/url]
    biomass energy program regional southeast [url=]biomass energy program regional southeast[/url]
    mugen character download [url=]mugen character download[/url]
    limewire basic free [url=]limewire basic free[/url]
    free dvd burning softwere [url=]free dvd burning softwere[/url]
    swallowtail butterfly [url=]swallowtail butterfly[/url]
    medicalfetish [url=]medicalfetish[/url]
    borders clipart [url=]borders clipart[/url]
    www [url=]www[/url]
    freeantivirus software [url=]freeantivirus software[/url]
    annual credit free [url=]annual credit free[/url]
    downloaddvd shrink [url=]downloaddvd shrink[/url]
    english mp3songs download [url=]english mp3songs download[/url]

  6. Anonymous Says:

  7. Anonymous Says:

  8. nixo Says:

    If you can’t see that Spring isn’t nicer than EJB? Ouch. You must like eating the elephant ;)

    1) I think you got that backwards.
    2) trading one bit of complexity for another less complex bit of complexity doesn’t sound like much of a win to me.
    What is wrong with POJO. The simplest servlet engine and a library of useful classes is all I’ve ever needed. It’s simple and fast isn’t complex (unless you make it so) and doesn’t involve related code being in lots of different places.
    OO sounds great on paper, but in reality all it means is that one logical process is spread over multiple class files instead of just one.
    I never understood how that was better.
    I also never quite got why java is better than C++.

  9. Ted Neward Says:

    You don’t understand why “java is better than C++”? Moron.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)