Monday 11 January 2016

Free JBoss Application Server Questions and Answers for Interviews page 3

 Free JBoss Application Server Questions and Answers

7). Which Hibernate object wraps the JDBC Connection?

The Session interface wraps a JDBC Connection. This interface is a single threaded object which represents a single unit of work with application and persistent database. It’s retrieved by the SessionFactory’s openSession() method

8). Is the Session Factory Thread safe?

Yes: that is many threads can access it cuncurrentely and request for sessions. It holds cached data that has been read in one unit of work and may be reused in a future unit of work. Good practice is to create it when the application is initialized.

9). How can you start a JTA transaction from a Servlet deployed on JBoss?

JBoss registers in the JNDI tree a JTA UserTransaction Object which can be user to manage a distributed transaction.

10). What if you need to span your transaction across multiple Servlet invocations?

You can’t with a Servlet. A JTA transaction must start and finish within a single invocation (of the service() method). You should consider using a Stateful SB. In a SFSB with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls.

Free JBoss Application Server Questions and Answers for Interviews:

                                                                                                       Read More >> Page 4