10. In Entity bean will the create method in EJB home and ejbCreate in
Entity bean have the same parameters ?
Yes, the client calls the create method passing in certain arguments and the
container inturn calls the ejbCreate with the same signature.
11. What is the difference between Containers managed persistent bean
and Bean managed persistent entity bean ?
In a bean managed persistance all loading, storing and synchonization is dealt with in the bean itself. The container will call create, ejbLoad and ejbStore methods. These methods should have implementations to do their required functionality. Bean managed persistance beans offer high degree of fluxibility, but it also increases the work needs to be done by the
developer. All persistant associations with other business objects are handled in the bean itself.
In a container managed persistance ejbLoad and ejbSave have to be implemented but would be empty. All loading, saving and reterival is handled by the containeritself. Associations with other business objects is also handled by the container. No SQL query needs to be written here, making this as very friendly to be deployed in any environment without any change to the code that require recompiling.
--------------------------------------------------------------------------------
Difference Container Managed Bean
Managed
--------------------------------------------------------------------------------
Class definition Abstract Not
abstract
Database access calls Generated by tools Coded by
developers
Persistent state Represented by virtual Coded as
public
persistent fields. instance
variables
Access methods for persistent Required None
and relationship field
findByPrimaryKey method Handled by container Coded by
developers
Customized finder methods Handled by container, Coded by
developers
but the developer must
define the EJB QL) queries
Select methods Handled by container None
Return value of ejbCreate Should be null Must be
the
primary
key
12. When to use container managed and bean managed persistence?
Container managed persistance is used when the persistant datastore is a
relational database and there is one to one mapping between a data represented in a table in the relational database and the ejb object. Bean managed persistance in used when there is no one to one mapping of the table and a complex query reteriving data from several tables needs to be performed to construct an ejb object. Bean managed is also used when the
persistence datastorage is not a relational database.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment