-
1. Re: Should findByPrimaryKey follow an ejbLoad() ?
alice Jun 30, 2002 2:34 AM (in response to alice)Will really appreciate if someone can answer. Thanks very much.
-
2. Re: Should findByPrimaryKey follow an ejbLoad() ?
albo Jun 30, 2002 9:20 AM (in response to alice)Your ejbFindByPrimaryKey should:
- SELECT to verify the PK being found exists
- return the PK
You should NOT populate your member fields.
Your ejbLoad will be called when you call a business method.
- alan -
3. Re: Should findByPrimaryKey follow an ejbLoad() ?
dsundstrom Jun 30, 2002 3:29 PM (in response to alice)It looks like you are using JAWS, and JAWS is not very smart about loading (actually it can't be because of the spec). JBossCMP (CMP 2.0) is a lot smarter about loading, and can be configured to not force a load for this code.
-
4. Re: Should findByPrimaryKey follow an ejbLoad() ?
alice Jul 1, 2002 9:03 PM (in response to alice)Hi Dain,
Do u mean to say that with JBossCMP, we won't need to force the loading and data will be loaded once I find the entity bean? What does the EJB2.0 spec say? Shouldn't entity bean instance be loaded automatically (so we don't have to force ejbLoad) whenever we do a findByPrimaryKey??
Thanks lot -
5. Re: Should findByPrimaryKey follow an ejbLoad() ?
dsundstrom Jul 2, 2002 6:04 PM (in response to alice)> Shouldn't entity bean instance be loaded
> automatically (so we don't have to force ejbLoad)
> whenever we do a findByPrimaryKey??
No, the find just needs make sure that the database has the key. For EJB 2.0 the container is only required to load the data for a field the is required to satisfy a getter. This means that the container can load an entity field by field as requested by a user. On the other end, you can configure the container to load all of the data on-find. Usually somewhere in the middle is best.
I suggest you read the Optimized Loading chapter of the JBossCMP documentation.