File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S : Couple of questions 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 "B&S : Couple of questions" Watch "B&S : Couple of questions" New topic

B&S : Couple of questions

Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
1> How to add RemoteException in throws clause of remote interface...

To declare the RemoteException in remote interface implementation of readRecord , I have to change the DBAccess interface readRecord method signature or adopt some pattern to decorate this ...If i don't declare throws RemoteException then it throws IllegalArgumentException at how do i change the method signature in local interface so it can throw RemoteException ?? IF i add throws IOException in local method signature then it will work fine but it seems wrong and i will violate the contract... what other option can be here....

2> Dynamic Schema implementation is required or we can hard code the fields for its size and name.I have been wondering a lot about this question .Because if i implement the dynamic schema then also i have to
declare primary key fields(which requires that you know the fields before).
can ranchers share their view on implementing dynamic schema or not implementing...pros & cons..

Waiting for gurus to reply ...


SCJP 1.4<br />SCWCD 1.4(91%)<br />Working on SCJD -Bodgitt & Scrapper Constructions...<br /> <br />"It takes 43 muscles to frown & 17 to smile but it doen't take any to just sit there with a dumb look on your face .. Keep Smiling "
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
that's one way to do it.
Another way is to have the DB interface available only to the server and expose something else entirely through RMI (a business object).

Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 159

1) for the remote interface I have an adapter that "adapts" a remote object to a DB interface. The Remote Exceptions are catched in the adapter and application specific exception are thrown further. For example in the DB "delete" method RemoteException is catched, RecordNotFoundException is thrown instead to satisfy the contract of the DB interface.

2) Dynamic Schema implementation makes no sense from my point of view because you still need a place where you must use the fields that are given in the specification.

Hope this helps,


Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer.
Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
for 1>
I am adding one more interface DBRemoteReference that mathces to DBAccess interface(provided by sun ) with additional IOException in throws clause of each method.My structure looks like the following

Am i implementing the Adapter pattern right ?? main concern is the bold part..Am i on the right path ??

2> for this i am thinking to get rid of dynamic schema and hard code the fields..what do you guys think about it ??

Thanks for all your support.
I agree. Here's the link:
subject: B&S : Couple of questions
jQuery in Action, 3rd edition