wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Advice about db interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Advice about db interface" Watch "Advice about db interface" New topic
Author

Advice about db interface

Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Hi,
Need some advice about the interface for the data access class in this assignment.
(a) Is this interface the same one that must be respected in the network layer and on the client side to call the data layer through the network layer?
or
(b) is this interface just for the data layer, allowing one to change the function calls in the network layer to make it easier for client? The reason I'm asking is:
(1) I thought the 3 layers are supposed to be independent tiers, so 1 could change the front end component with a different GUI layer, if needed.
or
(2) is (1) not a requirement?
The reason I'm asking is all functions in my interface use arrays and not objects, for example, was hoping to create a room reservation class and pass along network. My difficulty at mom. is I'm presently having difficulty wondering do I even need to create a room reservation class, since it mightn't even be passed along network.
Thanks.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5154
    
  12

Hi Mark,

It is certainly the interface for your Data access class, otherwise you will fail automatically. I don't think you can use that interface for your network layer, because no method is throwing the RemoteException for example. So you will have to create another interface and it's your choice to keep the same method signatures as sun's interface (but with the RemoteException) or create some kind of business interface (with methods like findRooms or bookRoom for example).

Your approach will be fully dependent on the answer to the question "will you expose lock methods to the client?". There is 1 big discussion which you can find here.

I followed the approach with the business service: my interface had just 2 methods and I used a transfer object to let the room data travel from server to client and from client to server. I also clarified this decision in my choices.txt

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Mark!

I'm with my good buddy Roel. But just one comment, the implementation of your remote interface will end up using the Data class (for more details of how it can be done, please take a look here). What I did is, I created an interface with the same methods of the interface that is provided in the assignment. For instance, only a few methods of it have to be used. But what if tomorrow they decide to add the functionality of creating records? If so, your interface is already prepared. Then, for my business interface, I just added, like 5 methods, including bookRoom and search. These methods use the remote interface implementation, which uses the Data class.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Cheers, Thanks for your kind replies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advice about db interface
 
Similar Threads
Problem with calling serialized class methods.
Passed SCJD - 354 /400
dealing with lock lost - URLyBird
About URLyBird 1.2.3 Assignment Question
General design question