Top.Mail.Ru
July 8th, 2005 - Java developers — LiveJournal
? ?

Java developers

July 8th, 2005
 

05:26 pm - Imageluciphah - JCA Resource Adapters, WSAD and Java JAR Dependencies

Hahah, you all thought I'd gone away and you were safe. How wrong you were. Here I am again with another inane question to make you groan.

Part of our project uses a JCA-compliant Resource Adapter (hereinafter referred to as RA, as I'm too lazy to keep typing that) to connect to a legacy system. Please once again bear in mind that I've inherited this project from previous developers who have now left. Now, the RA makes use of the SPI Connection, ManagedConnection, ConnectionFactory, ManagedConnectionFactory interfaces, which is great. However, it currently doesn't make use of the CCI Interaction and related interfaces, preferring instead to utilise a custom-written API. I think this is fine, at least from what I've read.

Now my question is this: Part of this API takes a class that is specific to our code as an argument, and later transforms it into the class required by the legacy system. So our main application code needs access to this class to be able to pass it in, and the RA needs access to the class to be able to use it. Originally, code specific to the RA and in fact the legacy system was being used in the main app, which completely defeats the object of having the RA in my opinion. So I shifted things around, put the JARs specific to the legacy system inside the RA, and moved the common class into a utility project which was then added to the Java JAR Dependencies and Java Build Path for both the main application and the RA.

Now, although the main application can see the common class, the RA cannot. I get a ClassDefNotFoundException whenever I try to call the RA. The only way I've managed to get it to work thus far is to import the classes from the Util project into the RA. I've googled for this and not found much... I'm guessing that an RA must have all of its dependent JARs packaged with it. In which case, would it be better to stick the common classes in the RA, and have the RA project on the Java Build Path and Java JAR Dependencies of the main application project? Is that the way it's meant to work?

I'd actually prefer to implement the Interaction stuff, but time is pressing and the RA is only an interim measure while we transition over to a new system to replace the legacy system.

 

10:28 pm - Imageex_simanyay - ResultSet and Statement live cycles

Hello. I've created a class that executes SQL queries and then returns ResultSet object if needed. My Connection object is in the class scope, but Statement is in the method scope. And now I've a problem, because ResultSet object, that I've returned, goes to isClosed() == true state after Statement object is deleted (when method ends). I've two three ways to solve this problem in my mind:
1. Put Statement into the class scope, but then I'll have new problem. If user will decide and store ResultSet object, he/she will not be able to execute new query, because ResultSet will go to isClosed() == true after the new query execution.
2. Create a pool of Statement objects. But how will I know, when I should delete some object?
3. Create new data structure that will act like ResultSet, but will be independent to Statement object.

Can anyone suggest anything?

Thanks a lot.

- sim

P.S. Sorry for my english :-(
Powered by LiveJournal.com
Image