D
David
I have been looking at EJBs for quite some time now and really am
struggling to see what all the fuss is about as I cant seem to think
of a killer reason for using them.
Could someone please tell me a situation where an EJB would be miles
better than a plane old Java bean?
- Our EJBs would live on the same server as the servlets and so any
distributed advantage is gone.
- Managing transactions with JTA is easy
- Method level security is handy, but hardly a killer reason.
- (Ignore MDBs for the time being)
Alternatives to EJBs... (Im sure a must be over simplifying this so
please feel free to tell me im wrong!)
1) A Stateless session bean can surely just be replaced with a normal
java bean and then just make calls to MyBean.myMethod() - ie no state
is preserved, just small bits of business logic are called.
2) A Stateful session bean can be replaced in a similar way except it
has to be dumped on and off the session object each time.
3) A BMP Entity bean can also be a normal java bean where the
constructor fetches the relevant row and sets all the values, then
each set method could update the db via JDBC. OK, so the SQL would
need to be written, but then its hardly rocket science is it?
4) A Bean managed entity bean has SQL etc burried in it anyway and so
could be rewritten as a java bean.
....Im sure Ive got something wrong here, there must be something that
can only be done with an EJB, but Im struggling to see what all the
fuss is about?
Thanks
David Bevan
http://www.davidbevan.co.uk
http://www.websphereusergroup.org.uk
struggling to see what all the fuss is about as I cant seem to think
of a killer reason for using them.
Could someone please tell me a situation where an EJB would be miles
better than a plane old Java bean?
- Our EJBs would live on the same server as the servlets and so any
distributed advantage is gone.
- Managing transactions with JTA is easy
- Method level security is handy, but hardly a killer reason.
- (Ignore MDBs for the time being)
Alternatives to EJBs... (Im sure a must be over simplifying this so
please feel free to tell me im wrong!)
1) A Stateless session bean can surely just be replaced with a normal
java bean and then just make calls to MyBean.myMethod() - ie no state
is preserved, just small bits of business logic are called.
2) A Stateful session bean can be replaced in a similar way except it
has to be dumped on and off the session object each time.
3) A BMP Entity bean can also be a normal java bean where the
constructor fetches the relevant row and sets all the values, then
each set method could update the db via JDBC. OK, so the SQL would
need to be written, but then its hardly rocket science is it?
4) A Bean managed entity bean has SQL etc burried in it anyway and so
could be rewritten as a java bean.
....Im sure Ive got something wrong here, there must be something that
can only be done with an EJB, but Im struggling to see what all the
fuss is about?
Thanks
David Bevan
http://www.davidbevan.co.uk
http://www.websphereusergroup.org.uk