aspose file tools*
The moose likes JBoss/WildFly and the fly likes Is it Possible... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Is it Possible..." Watch "Is it Possible..." New topic
Author

Is it Possible...

Alan Hicks
Greenhorn

Joined: Mar 09, 2003
Posts: 7
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

Joined: Oct 06, 2002
Posts: 303
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

Joined: Oct 06, 2002
Posts: 303
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

Joined: Mar 09, 2003
Posts: 7
Cheers,
Thats given me food for thought.
Alan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it Possible...