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.
SOURCE : www.referjava.com
Saturday, March 10, 2007
How is entity bean created using Container managed entity bean ?
In both container managed and bean managed when the client calls create the call is passed on to ejbCreate.
In a container managed bean ejbCreate method will initialize all instance variables based ont he input arguments passed in. Once ejbCreate method completesthe container will automatically persist the bean. ejbCreate would return null.This is because: it is not practially possible to generate a primary key in ejbCreate and it would be impossible to get hold of the primary key for a row in a table even before the row exists as storage happens only after
ejbCreatecall completes.
In a bean managed persistance the ejbCreate will perform the fallowing:
i. Create an entry in the database
ii. Initialize the instance variables
iii. Return the primary key.
SOURCE : www.referjava.com
In a container managed bean ejbCreate method will initialize all instance variables based ont he input arguments passed in. Once ejbCreate method completesthe container will automatically persist the bean. ejbCreate would return null.This is because: it is not practially possible to generate a primary key in ejbCreate and it would be impossible to get hold of the primary key for a row in a table even before the row exists as storage happens only after
ejbCreatecall completes.
In a bean managed persistance the ejbCreate will perform the fallowing:
i. Create an entry in the database
ii. Initialize the instance variables
iii. Return the primary key.
SOURCE : www.referjava.com
What are the methods of Entity Bean?
setEntityState
create
ejbCreate
ejbPostCreate
ejbActivate
ejbPassivate
remove
ejbRemove
unsetEntityState
SOURCE : www.referjava.com
create
ejbCreate
ejbPostCreate
ejbActivate
ejbPassivate
remove
ejbRemove
unsetEntityState
SOURCE : www.referjava.com
Why does EJB needs two interface (Home and Remote Interface) ?
To handle the network tranport layer. TODO I do not have much knowledge to explain further.
SOURCE : www.referjava.com
SOURCE : www.referjava.com
When to use session, entity and message driven beans?
Session beans are used to represent a business procedure and no persistance
Is required. Session bean represents a client in the server. Entity beans represent a business logic compared procedure. Entity beans are typically shared between several session beans and persist beyond the scope of the application.
Message driven beans are new in j2ee 2.0 and are asynchronous beans typically
used to inteact with legacy batch processing systems.
SOURCE : www.referjava.com
Is required. Session bean represents a client in the server. Entity beans represent a business logic compared procedure. Entity beans are typically shared between several session beans and persist beyond the scope of the application.
Message driven beans are new in j2ee 2.0 and are asynchronous beans typically
used to inteact with legacy batch processing systems.
SOURCE : www.referjava.com
Monday, March 5, 2007
What is component mapping in hibernate?
Lazy setting decides whether to load child objects while loading the Parent Object.You need to do this setting respective hibernate mapping file of the parent class.Lazy = true (means not to load child)By default the lazy loading of the child objects is true. This make sure that the child objects are not loaded unless they are explicitly invoked in the application by calling getChild() method on parent.In this case hibernate issues a fresh database call to load the child when getChild() is actully called on the Parent object.But in some cases you do need to load the child objects when parent is loaded. Just make the lazy=false and hibernate will load the child when parent is loaded from the database.Exampleslazy=true (default)Address child of User class can be made lazy if it is not required frequently.lazy=falseBut you may need to load the Author object for Book parent whenever you deal with the book for online bookshop.
SOURCE : www.referjava.com
SOURCE : www.referjava.com
Why do you need ORM tools like hibernate?
To overcome the "paradigm mismatch" between object oriented data and table oriented relational databases.
SOURCE : www.referjava.com
SOURCE : www.referjava.com
Subscribe to:
Posts (Atom)