• 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

data access tier

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey all,
2 design questions:
i develop a webapp trying to keep it mvc clean. so, there are business beans and data access classes responsible for those beans-to-database relations (loading, storing, etc).
1. i've seen that some folks make the methods of the data access classes static and some others don't. what is the better solution? does static in this case means thread safe?
2. there is a chance that in the code i'll need a number of those data access methods in a sequence. taking in account that i use a connection pooling, would you make those methods receive a Connection object from outside (this way a number of methods will be executed with the same connection, but i'll have to leave all connection.close() bla bla bla stuff
out of the method scope) or would you put all of the db connection logic inside the methods (this way i'll have to take a new connection from the pool for each method and method...) ?
and, if you are in the "let's help this guy" mood, take a look at this :
https://coderanch.com/t/358009/Servlets/java/architecure-dbcp
may be you'll give me a cool advice.
thanks
cL:.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Cyc Lid",
Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
JDBC Forum Bartender
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic