• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Beans/Data?  RSS feed

 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a long time java programmer first time J2EE programmer that has a couple of questions regarding Entity Beans. My question is this, do you need a seperate Entity Bean for every table in your database that you want to access or am I getting the wrong idea totally. Also if you access your data through entity beans how do you execute joins and procedures etc.. Thanks for you help its greatly appreciated.
I'm currently running JBoss 3.2.1
Tomcat 4.2.24
Java 1.4_02
Developing using Emacs.
[ September 04, 2003: Message edited by: Sloan Bowman ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While you can have a single entity bean that spans multiple tables, this is very complicated. Most of the things I've read recommend a separate entity bean for each table.
If you want to do joins, two choices come to mind:
1) Write JDBC and have the entity bean call it
2) Navigate through the relationships of the entity beans. For example, find the first entity bean by its primary key or a field. Then navigate to another table using the foreign key.
If you want to use a stored procedure, you have to use JDBC and have the entity bean call it.
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay that is what I thought. So I now ask this question. How does using EJB Entity Beans make it better than using JDBC through properly written Data Access Objects. What benifits would I get from using a more complicated design pattern?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!