This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Originally posted by Bruce Jin: When I need to pull data from several tables with joins, I use one sql query string with join clauses. Can I create a single entity bean to present this “joined table”? Thanks
It depends on your Object-to-Relational mapping implementation (or you, yourself if you're using BMP). Most implementations map one entity bean to a single table, though.
James Carman, President<br />Carman Consulting, Inc.
You may want to take a look at "Core J2EE Patterns". It does a nice job discussing things like this at a high level and even provides a section on design considerations and bad practices. On the the practices the book says should be avoided is "Mapping Relational Model Directly to Entity Bean Model". EJB was intended to be for course-grained objects. Created entity beans at the table level produces (in general) a very fine grained approach. Modeling a entity bean for a row in a single table can result in scalabilty problems if your processing results in the retrieval/manipulation of a large result set where each row is an entity bean. Regards,