Question: Is there a guarantee of uniqueness for entity beans?
Answer: There is no such guarantee. The server (or servers) can instantiate as many instances of the same underlying Entity Bean (with the same PK) as it wants. However, each instance is guaranteed to have up-to-date data values, and be transactionally consistent, so uniqueness is not required. This allows the server to scale the system to support multiple threads, multiple concurrent requests, and multiple hosts.
Question: How do the six transaction attributes map to isolation levels like "dirty read"? Will an attribute like "Required" lock out other readers until I'm finished updating?
Answer: The Transaction Attributes in EJB do not map to the Transaction Isolation levels used in JDBC. This is a common misconception. Transaction Attributes specify to the container when a Transaction should be started, suspended(paused) and committed between method invocations on Enterprise JavaBeans. For more details and a summary of Transaction Attributes refer to section 11.6 of the EJB 1.1 specification.
Question: I have created a remote reference to an EJB in FirstServlet. Can I put the reference in a servlet session and use that in SecondServlet?
Answer: Yes. The EJB client (in this case your servlet) acquires a remote reference to an EJB from the Home Interface; that reference is serializable and can be passed from servlet to servlet. If it is a session bean, then the EJB server will consider your web client's servlet session to correspond to a single EJB session, which is usually (but not always) what you want.
Question: Can the primary key in the entity bean be a Java primitive type such as int?
Answer: The primary key can't be a primitive type--use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive)
Question: What's new in the EJB 2.0 specification?
Answer: Following are the main features supported in EJB 2.0 * Integration of EJB with JMS * Message Driven Beans * Implement additional Business methods in Home interface which are not specific for bean instance. * EJB QL.
Question: What is the need of Remote and Home interface. Why cant it be in one?
Answer: In a few words, I would say that the main reason is because there is a clear division of roles and responsabilities between the two interfaces.
The home interface is your way to communicate with the container, that is who is responsable of creating, locating even removing one or more beans.
The remote interface is your link to the bean, that will allow you to remotely access to all its methods and members.
As you can see there are two distinct elements (the container and the beans) and you need two different interfaces for accessing to both of them.
Question: What is the difference between Java Beans and EJB?s?
Answer: Java Beans are client-side objects and EJBs are server side object, and they have completely different development, lifecycle, purpose.
Question: Question: With regard to Entity Beans, what happens if both my EJB Server and Database crash, what will happen to unsaved changes? Is there any transactional log file used?
Answer: Actually, if your EJB server crashes, you will not even be able to make a connection to the server to perform a bean lookup, as the server will no longer be listening on the port for incoming JNDI lookup requests. You will lose any data that wasn't committed prior to the crash. This is where you should start looking into clustering your EJB server.
Another Answer:
Hi, Any unsaved and uncommited changes are lost the moment your EJB Server crashes. If your database also crashes, then all the saved changes are also lost unless you have some backup or some recovery mechanism to retrieve the data. So consider database replication and EJB Clustering for such scenarios, though the occurence of such a thing is very very rare. Thx, Uma All databse have the concept of log files(for exampe oracle have redo log files concept). So if data bases crashes then on starting up they fill look up the log files to perform all pending jobs. But is EJB crashes, It depend upon the container how frequenlty it passivates or how frequesntly it refreshes the data with Database.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment