• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Advice about db interface

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10451
137
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers, Thanks for your kind replies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic