1

I would like to know if using singleton pattern for my databaseHelper.java class, which have all database related operations i.e (Crud) is a good idea or not? I want to minimize my database hit and memory usage. I use c3p0 i.e connection pooling.

Blizzer
  • 260
  • 4
  • 22
varsha
  • 304
  • 8
  • 22

1 Answers1

2

Strictly speaking, this is an awful idea for too many reasons.

I suggest you run a simple google search, and even here to find out why. No point in spaming this site.

For example:

Try looking at the solutions provided by the Spring framework. It would give you a much better starting point.

Community
  • 1
  • 1
Eran Harel
  • 2,325
  • 19
  • 28