Hello All, Does anyone know if its possible to have a CMP Bean that represents information from two tables. i have a tb_user and tb_student and i want to create a bean that will represent both sets of fields? can anyone help?
Hi there, No it's not possible at this time. There has been some discussion about this feature on the JBoss forums and the consensus reached is as follows: 1. Multi-table CMP entity beans will be supported in JBoss 4.0. 2. The JBoss group will implement this feature for you on a consulting-type basis (NB: Read as '$$$'). 3. In the bean time, write each table as its own bean and establish CMR relationships between them. Sucks, I know, but there you go! Darryl
Darryl A. J. Staflund
Joined: Oct 06, 2002
Actually, There may be a work-around that you might want to consider: 1. Create a database view of the data you want to encapsulate in a single entity bean. 2. Create database rules that will intercept insert, update, and delete requests send to the view and have them map the view fields to the appropriate tables. 3. Create a CMP entity bean that works off the view instead of the tables. I believe this should work if your database will support it. Darryl