Showing posts with label Java Interview Question and Java Beginner Tutorial - Part 2. Show all posts
Showing posts with label Java Interview Question and Java Beginner Tutorial - Part 2. Show all posts

Thursday, January 19, 2012

Java Interview Question and Java Beginner Tutorial - Part 4

Is there any way to force an Entity Bean to store itself to the db? I don’t wanna wait for the container to update the db, I want to do it NOW! Is it possible?

 Specify the transaction attribute of the bean as RequiresNew. Then as per section 11.6.2.4 of the EJB v 1.1 spec EJB container automatically starts a new transaction before the method call. The container also performs the commit protocol before the method result is sent to the client.

    Java Interview Question and Java Beginner Tutorial - Part 2

    Is it possible to write two EJB’s that share the same Remote and Home interfaces, and have different bean classes? if so, what are the advantages/disadvantages?

    It’s certainly possible. In fact, there’s an example that ships with the Inprise Application Server of an Account interface with separate implementations for CheckingAccount and SavingsAccount, one of which was CMP and one of which was BMP.