Hi, 1) What is the basic difference between EJB1.0, EJB1.1 and EJB2.0 in the EJB Structure(ie. in the Home interface, Remote Interface and Bean Class). I knew that in EJB2.0 features Message Driven Bean,local interface. 2) Is it possible in EJB2.0 to define two tables in a CMP. If it so please give the sample programs. Thanks & Regards, M.S.Raman.
In brief, the EJB 2.0 specification introduces these new features: Message-driven beans 1. An improved architecture for container-managed persistence 2. Container-managed relationships for entity beans with container-managed persistence 3. Local interfaces 4. Enterprise JavaBeans Query Language
Basic differences: 1.0: - no mandate that Entity EJB must be supported by EJB container - no Message Driven Bean - EJB communication backbone uses RMI-JRMP - no CMP Entity EJB - no Deployment Descriptor xml file, use compiled class, then serializes it into flat file (binary). 1.1: - Entity Bean must be supported by EJB container - no Message Driven Bean - has CMP, but never describe how to configure relationship between CMP EntityEJBs, this depends on container tool provided by vendor - RMI-IIOP is suggested for EJB communication - Deployment Descriptor xml file is introduced 2.0: - Message Driven Bean is introduced - With CMP, you can configure the relationship between CMP EntityEJBs, in ejb-jar.xml - EJB-QL for CMP EntityEJB query language - RMI-IIOP is a must for EJB communication
===================================<br />Fear not, God know the best.<br />SCJP2 91%<br />SCWCD 89%<br />SCJD2 92% (143/155 pts)<br />SCEA Part I (89%)
Alexander Yanuar Koentjara
Joined: Jun 03, 2002
>2) Is it possible in EJB2.0 to define two tables in a CMP. If it so please give the sample programs. Cannot. In Web Logic deployment descriptor, you must indicate one table in database for one CMP EntityEJB. But, for your case, you have several alternatives: 1. declare the secondary table as another Entity EJB, then you can set up the relationship. 2. Use BMP, with DAO to access both primary & secondary table. 3. discard the secondary table, and use blob in main table instead. Then, you can use java serialization method to convert values of secondary table to binary. This only work for 1-1 relationship (example: profile as secondary table in customer table, profile contains name, address, company, telephone. Then you can make a class called ProfileValueObject, use serializable method to convert it into bytes, then store it as blob in customer table) 4. merge the table into one, work only for 1-1 relationship.