• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design patterns for JSP/JavaBean/Database

 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
While designing a 3-tiered application, what is the Best Design Pattern to manage transferring the data between the Database and the Bean layer?
To be more specific, should the JavaBean layer get it's data just once from the Database, and then hold that data at the JavaBean level until the JSP requests additional DB interaction.When should we consider synchronization of data, so that there is miminal performance hit
Thanks in advance.
Regards,
Sandeep Desai
vgdesai@bom3.vsnl.net.in

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  5. [This message has been edited by Desai Sandeep (edited April 26, 2001).]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Desai Sandeep:
While designing a 3-tiered application, what is the [b]Best Design Pattern to manage transferring the data between the Database and the Bean layer?[/B]


There is no single answer. You will want to cache data in a session-bound bean only if the data is session specific, will not be mutated elsewhere (or can be treated as such), and if its size is small compared to the time it would take to retrieve it.
- Peter
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Is it a good practice to defer the synchornization, until there is a request for the some data from the Database, or should it be on insertion of a new record.
What is the general trend.Is there already any available pattern for this?
Thanks in advance,


------------------
Sandeep Desai
vgdesai@bom3.vsnl.net.in

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Peter den Haan
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's becoming boring, but again no single answer.
If you are sure you're usually going to need all the data, or there is no appreciable extra overhead in loading up all the data, then you don't bother with lazy loading: the extra tests (if (data == null) then load) are just an extra bit of complexity and wasted CPU cycles.
If, on the other hand, the data is bulky and/or it takes extra time to load, and you are not sure that the data will be used, by all means defer loading.
- Peter
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,
I am with you!!
It must depend on the kind of application you have.Perhaps, this could be the reason, Oracle Business Component for Java(Oracle implementaion on the lines of EJB!!...IMHO, it is better than EJB!!) provides all the options to the developer - lazy loading,synchorinization at the time of update, insert, etc.
Regards,

------------------
Sandeep Desai
vgdesai@bom3.vsnl.net.in

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic