QB - Jayaram College of Engineering and Technology
QB - Jayaram College of Engineering and Technology
QB - Jayaram College of Engineering and Technology
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
11. Why would a session bean use bean-managed transactions<br />
In some situations, it's necessary for a (stateful) session bean to selectively<br />
control which methods participate in transactions, <strong>and</strong> then take over the<br />
bundling <strong>of</strong> operations that form a logical unit <strong>of</strong> work.<br />
12. Is method overloading allowed in EJB<br />
Yes you can overload methods.<br />
13. How can JMS be used from EJB 1.1<br />
The same as any client would use JMS. At this point there is no integration, but it<br />
is planned for a future release <strong>of</strong> the EJB spec.<br />
14. Can primary keys contain more than one field<br />
Yes, a primary key can have as many fields as the developer feels is necessary,<br />
just make sure that each field you specify as the primary key, you also specify a<br />
matching field in the bean class. A primary key is simply one or more attributes<br />
which uniquely identify a specific element in a database. Also, remember to<br />
account for all fields in the equals() <strong>and</strong> hashCode() methods.<br />
15. Which fields in beans should be public<br />
All Container Managed Fields in an Entity Bean must be public.<br />
Ejb 1.1 spec section 9.4.1 - "The fields must be defined in the entity bean class<br />
as public, <strong>and</strong> must not be defined as transient."<br />
16. How do I automatically generate primary keys<br />
A common way to do it is to use a stateless session bean to retrieve the ID that<br />
you wish to use as the primary key. This stateless session bean can then<br />
execute an Oracle sequencer or procedure etc. to retrieve the ID value used as<br />
the primary key.<br />
17 What are the different type <strong>of</strong> Enterprise JavaBeans <br />
There are 3 types <strong>of</strong> enterprise beans, namely: Session bean, Entity beans<br />
<strong>and</strong> Message driven beans.<br />
Department <strong>of</strong> IT, JCET, Trichy. Page 8