• Post Reply Bookmark Topic Watch Topic
  • New Topic

1000 entity beans?? impossible!!

 
jasmine tan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to build a forum based on the EJB architecture. Now in the database, i have a table for each topic in the forum and this table(name of table being the topic_id) will contain information about all the articles under that topic (i.e article_id(primary key), article_title, article_body and so on).
In this light, does it mean that if my forum has 1000 topics( questions asked) den i would need to have 1000 entity beans since one entity bean represents one table?
I don't suppose so. Each table should be represented by an instance of the entity bean.Then how am i supposed to uniquely identify each entity bean and know which table it is pointing to? Can anyone give me a simple example?
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hopefully not. An EJB isn't a permanent clone of the database record - it's an accessing mechanism. Unless your app grabs an EJB for each topic AND DOESN'T LET GO, the EJBs would be used to fetch the data and then deprecated -- ultimately destroyed. If EJBs were once and for permanent, there'd be no sense in having an EJB cache!
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a design that contains 100 tables is a bad idea.
Why not one topic table containing all the information about each topic. And then have an article table containing information about each article which has a foreign key back to the topic table. Then if you add a new topic, all you do is add a new row to the topic table instead of creating a new table.
------------------
Tom
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!