>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.