• 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

HttpSessionBindingListener database synchronization confusion

 
Greenhorn
Posts: 26
IntelliJ IDE jQuery Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am reading Head First JSP and Servlets and preparing for the exam. It says in topic of HttpSessionBindingListener, that its valueBound() and valueUnBound() can be used when we need to synchronize with the database. I am not aware much about entities with respect to databases. But that is what i get that let say we can make Dog class an Entity and make it implement HttpSessionBindingListener. But still i am unable to understand when we say when it is added to session and it is removed, how valueBound() and valueUnBound() can help synchonize with the database. Are these methods where we will be doing database CRUD operations?
Thanks,
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

Did you read the explanation in chapter 5 on page 183?

When to synchronize your objects with the database is always a question of web-design. Do you want to update every change to the database or do you want postpone and update a batch of changes.

Are these methods where we will be doing database CRUD operations?


You could do a read in the valueBound() and an update in the valueUnBound() method as an example.

Regards,
Frits
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic