Reputation: 314
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.
Upvotes: 1
Views: 1005
Reputation: 2365
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.
Upvotes: 2