Karan Jain

Ranch Hand
+ Follow
since May 30, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Karan Jain


Our application is kind of legacy applicaiton written in Java swing and sybase stored procedures.
Do you know of any good tool to debug stored procedures from Java code itself.

There are tools like Rapid sql which can debug stored procedures individually.
The same vendor had rapid sql developer to debug sql from Java code but it seems they retired that product.

Any help is really appreciated.


9 years ago
Thanks Mark for the response. I will try to implement using those namespaces.

But my requirement is to load the context even if my listener fails.

As there are other services which needs loading even the cache refresh does not work.

How can I achieve that?
9 years ago

One part of my application is listening to a topic for refreshing my cache.

But suppose the server which is publishing the message is down. I still want my application to come up.
I tried to set lazy-int = true and then after the context is loaded tried to do context.getBean("testUpdateListener") thinking it will initialize the bean and it will start listening.
But it does not work. The listener does not start listening.

What is the best way to achieve this?

9 years ago
Thanks for sharing your thoughts guys.

I maintain an audit table for these kind of scenarios.
But what I generally do is get a new key for the row and then manually increment the version by querying the last inserted row.
Then just increment the version. Update the main table and insert into audit.

So the question is what is the best way to do that.

But auto increment version what I meant was to get a new row with just a new version and not the new id itself.
So if (1,1) is there... Can I get automatically get (1,2) or I need to query (1,1) and then update to (1,2) and insert (1,2).
Thanks for the reply.

The key id and version have no business logic as such other than they shows all the actions on a record.

So I would like to have records with ids

1 1 ----- data --- new records
1 2 ------ data ---- modification
1 3 ------ data ------ another modification

I understand that I can auto-generate the main key but still not getting how to increment the version automatically using JPA/hibernate annotations?

is it possible?


I am new to Hibernate mapping and wondering if I can have a primary key like below.

Keyid, version

So everytime I enter a new record it creates an entry like (1,1)
everytime I modify on that record it just updates the version (1,2), (1,3)....

How can I achieve it using auto generated keys? Or can I have it using autogenerated keys? Or I need to manually increment the version.
Please advise.


What are good options available for writing GUI in Java.
Writing GUI in java seems tedious, so is there a good framework we can use with cool widgets etc?
Its a trading application and would need lots of tables, dialogs, export to excel, Sorting kind of functionality.

Any pointers is appreciated.

10 years ago

I have a requirement where i have a property file(Name, Value pair) having 300,000 records and size is suppose 3 GB. I need to persist in the database.
What approach can be taken to effectively persist in the database.

I mean:
1. How to read the file?
2. What collections can be used?
3. How to effectively handle the transaction.

Any views are appreciated!

Thanks in advance!
12 years ago
Thanks for the response.

The scenario is like this:

1. J2EE app send a message on request Q for Mainframe app and wait for the response on the response Q for 2 mins.
2. When mainframe app completes the message processing it writes the response on the response Q.
3. But if Mainframe app takes more than 2 mins to write the message on the response, the J2EE app timesout and shows a popup error on the screen to the user.
4. Now if the mainframe writes the message on the response Q, it get stuck for ever.

Is there any good way to handle this scenario.

Thanks in advance.

I am working on enhancement of an old J2EE application which communicates with Mainframes using MQ.
After sending the data to MQ request Queue it waits for the reply on the response queue. The wait period is 2 mins.
After that it shows an popup to user that there is problem processing your request, but on the mainframes side the request was processed and data is updated in their database. So our database is out of sync and also the message is stuck in the queue forever.

How can I enhance it so that our database is updated properly?

Any suggestions are appreciated.

Thanks in advance,


I want to generate a report which can have a million records pulled from the database. I want to display the report in synchronous ( if the user asks for the report, I should show it on the screen) and asynchronous way (we can send an email or any other notification after we generate the report in the background).

My questions are:
1) What is the good strategy to do this task?
2) What considerations I need to make for it in terms of database and other resources.

Any inputs are appreciated.

Thanks and regards,
13 years ago

Any tips for us!!!
13 years ago
Thanks Norm,

I was able to make it work using Commons HttpClient.

I did the following:
1. Send the request using the logon URL with user name and password as NV pairs.
2. The URL send the response with cookies.
3. Send the next request setting the cookies in the header and it gives the response as the file.

Thanks a lot for pointing me to right direction.
Thanks Norm.

Yes the website is setting the cookies.

I know the login URL and I am able to get the cookies in the response which I am able to print.

But how to set the cookies in the system so that next time when I am trying to access the website it should recognise me and should allow me to download the required files.


I have access to the client website where i can login and can download some file by selecting my specific criteria. I can then download 1 file at a time by selecting the file.

What I want is write a java program which will login me on the website and then enable me to download the files 1 after the other. I have login URL and the file URLs (as I can modify the IDs in the URL to point to next file).

I tried to use Commons HTTPClient but I am not successful in doing so. I am unable to set the cookies and then point to file URLs.

Client's website is in .Net.

Do I need to ask the client how they are setting the cookie so that i can do the same in my java program?

Please guide me to achieve this.

Thanks in advance...