• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

should adapter implement Db interface

 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Db interface is provided by Sun. If it impelment it, I can't throw RemoteException and IOException. If I don't implment it, it looks strange as it should provides same services as Db. Anyone has idea?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George,
Is this the same question asked by Hugh in this thread? Or are you asking about something else?
Regards, Andrew
 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
I have 2 questions about it.
1. Should apadter implement any interface? e.g. Db.java (provided by SUN).
2. In Data class, we can only throw RecordNotFOundException, SecurityException? Then, how can let user know it has RemoteException and IOExcpeiont to client GUI?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George
The Db interface provided by Sun is the interface you have to code to in order to create the Data class. Nothing more.
The Data class has to provide a single point of access to the database. It encapsulates all the methods any other class will use to access the database.
You can then create some other class or classes that will provide network access to the Data class. These classes do not necessarily have to implement the Db interface - they can implement any inteface you desire.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic