SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Paul Sturrock wrote:I don't follow. You have a method that returns the type java.sql.Connection and you are trying to assign it to a variable that expects the type DBManager. Perhaps the concept of a singleton is confusing the issue? Why do you want to use a singleton? What you have coded is not a singleton, by the way.
Faiz Abdelhafid wrote:
Paul Sturrock wrote:I don't follow. You have a method that returns the type java.sql.Connection and you are trying to assign it to a variable that expects the type DBManager. Perhaps the concept of a singleton is confusing the issue? Why do you want to use a singleton? What you have coded is not a singleton, by the way.
Hello Paul,
Well the main idea behind coding the class as a singleton pattern is because I need just a one connection object a long with the system, and also disabling creating another instance from the connection.
I solved the problem thanks !
Paul Sturrock wrote:
Faiz Abdelhafid wrote:
Paul Sturrock wrote:I don't follow. You have a method that returns the type java.sql.Connection and you are trying to assign it to a variable that expects the type DBManager. Perhaps the concept of a singleton is confusing the issue? Why do you want to use a singleton? What you have coded is not a singleton, by the way.
Hello Paul,
Well the main idea behind coding the class as a singleton pattern is because I need just a one connection object a long with the system, and also disabling creating another instance from the connection.
I solved the problem thanks !
OK, but what you've got above is not a singleton, many instances of DBManager can exist using that code.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Jothi Shankar Kumar wrote:I can easily clone your class to create a new instance. I don't understand your argument. the openConnection() method returns a Connection and not a DBManager. Are you disagreeing with that?
Don't get me started about those stupid light bulbs. |