I don't know why I bother! The majority of my posts over the last week or so have been of so little value that I don't even get a simple "that does not work".
I don't know why the OP found it a problem that the ResultSet was closed by the legacy application but I provided a viable solution to this problem 15 minutes after it was first posted and 10 hours later still nothing from the OP!
One more to add to my 'not worth responding' list!
> I think a detached RowSet would be a better idea.
> Passing around ResultSets is usually a bad idea in
> my view. The OP's approach is bad from the point of
> view of layering an application and scaling.
>
> %
Possibly but I have used dynamic proxies many times but I have never used a detached RowSet. I agree that passing round a ResultSet is very poor but when you have to fit in with a legacy application then you are often forced into using a cludge.
A Resultset is mainly a Java front end for a database cursor (which exists on the database server). When the ResultSet is closed, the cursor will be closed too so, even if you could copy everything in the ResultSet object, the handle for the cursor would no longer be valid.
To truely "deep copy" a resultset the depth would have to extend accros the database connection to cloning the cursor.
>Write a dynamic proxy to the ResultSet where the close() method does >nothing.
What if the OP discovers that the app does a rs=null as well?
The op then runs thru hoops to get permission to modify a line in legacy code and is too distressed to post.
Anyway, thanks for the classrom solution. but i cant create another class file for extending rs.
If you are too distressed by the posts here, you are under no obligation to reply to every one. Anyway , i found the post
> A Resultset is mainly a Java front end for a database
> cursor (which exists on the database server). When
> the ResultSet is closed, the cursor will be closed
> too so, even if you could copy everything in the
> ResultSet object, the handle for the cursor would no
> longer be valid.
>
> To truely "deep copy" a resultset the depth would
> have to extend accros the database connection to
> cloning the cursor.
very much useful than the self pity expressed by you.
No offence, none taken and none dealt.
> >Write a dynamic proxy to the ResultSet where the
> close() method does >nothing.
>
> What if the OP discovers that the app does a rs=null
> as well?
How can that affect your code? Presumably the ResultSet is passed as an argument to a legacy method so the legacy method might set it's local reference to null it will not affect the reference held by the caller of the method.
> The op then runs thru hoops to get permission to
> modify a line in legacy code and is too distressed to
> post.
He does not need to! You need to learn about Java argument passing.
> Anyway, thanks for the classrom solution. but i cant
> create another class file for extending rs.
You have not presented any reason why not! This can be an inner class in the code you are writing and has no influence what so ever on the legacy application.
>
> If you are too distressed by the posts here, you are
> under no obligation to reply to every one. Anyway , i
> found the post
I replied because I had a viable solution to a problem you were having. Nothing you have said so far stops it being viable. Look at my posting history - I do not try to reply to everyone.
>
> > A Resultset is mainly a Java front end for a
> database
> > cursor (which exists on the database server). When
> > the ResultSet is closed, the cursor will be closed
> > too so, even if you could copy everything in the
> > ResultSet object, the handle for the cursor would
> no
> > longer be valid.
Which is why you use a Proxy so that you can control exactly what happens.
> >
> > To truely "deep copy" a resultset the depth would
> > have to extend accros the database connection to
> > cloning the cursor.
I still don't see why you need to clone the ResultSet rather than use a proxy!
>
> very much useful than the self pity expressed by
> you.
No self pity! I just expressed annoyance at the lack of feedback from you and many others.
> No offence, none taken and none dealt.
I still find it offensive when people don't bother with a simple acknowledgement. I don't ask many questions myself but when I do I make sure I track the responses and acknowledge those who try to help.
I still think you should re-think your solution but you are free to totally ignore my very simple solution. I expect you will ignore it so the best of luck.
aaaarrrrggg.....I cannot create another class, i need to do it all inside of TerminationReport.java. I cannot create another file in the CVS. coz i'm stuck *** deep in beaurocratic muck.
Why cant they let the programmers decide abt programming
Soln: I fired the same query twice..perfornance? nobody cares
Consider the OP shot by a 357 magnum for bad programming and not acknowledging.
> aaaarrrrggg.....I cannot create another class, i need
> to do it all inside of TerminationReport.java. I
> cannot create another file in the CVS. coz i'm stuck
> *** deep in beaurocratic muck.
It can be an inner class! It is only about 20 lines of code! No need for a new file!
> Why cant they let the programmers decide abt
> programming
> Soln: I fired the same query twice..perfornance?
> nobody cares
Yes! We have all suffered from this.
> Consider the OP shot by a 357 magnum for bad
> programming and not acknowledging.
If the bad programming is forced on you then the project admins are just shooting themselves so don't get hung up.