• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

1000 entity beans?? impossible!!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 28419
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic