Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it Possible...

 
Alan Hicks
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Alan Hicks
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers,
Thats given me food for thought.
Alan.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic