> EJB home methods are like static methods. They're specific to the
> particular EJB class, but not to a particular EJB instance. They were
[quoted text clipped - 4 lines]
> "Home methods are methods that the Bean Provider supplies for
> business logic that is not specific to an entity bean instance."
> is this *home methods* ONLY for entity beans ?
Yes. Only for entity beans.
> what kind of code is written in these *home methods* ?
Whatever you need. Any code that you think should be part of that
particular EJB class but is not associated with any specific entity.
> does it set any environment properties etc for the
> whole class in this method ?
Environment properties? Those come from the deployment descriptor.
> please explain , this part is not clear ....why and how we use it ?
Most people never use it. It wasn't even available prior to EJB 2.0.
It's there for the special cases when you need it.
Here's one obvious example:
Suppose that you have an entity EJB associated with a particular
database table (that's not much of a stretch). Now suppose that you
need a count() method that tells you how many rows there are in that
table. In the old days of EJB 1 you'd have to write a "finder" method
that returned the primary keys for all of the rows, which would then
cause the container to create entity beans for all of the rows, just so
you could count how many EJBs you got back. With EJB 2 and home
business methods, you can just do a "SELECT COUNT(*)" and return the
int value. This is a big improvement when you're dealing with tables
with thousands or millions of rows.
gk - 10 Nov 2006 23:59 GMT
> > is this *home methods* ONLY for entity beans ?
>
[quoted text clipped - 27 lines]
> int value. This is a big improvement when you're dealing with tables
> with thousands or millions of rows.
nice example.
thank you