Padma Lalwani

Ranch Hand
+ Follow
since Nov 02, 2004
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Padma Lalwani

In addition to jar file, try putting the zip file of the driver in you server lib folder too. I have in my classpath in addition to jar file
11 years ago
Can you not just update the matching records? Why delete and insert?

update a
set a.filepath=b.filepath
from a,b
where a.recordid=b.recordid
I am thinking starting with begin() should be good enough, because that is the logical boundary for a new transaction
If it is unit tests it is advisable to avoid making db connections, and to hard code expected data within unit test

If it is integration/system testing, making database connections is valid. But to answer your question, I dont think JUnit as such provides any specific connection reuse mechanism

You would resort to using Connection Pool, but since performance is not a consideration while testing, you can get a new connection everytime to simplify your test logic

11 years ago
Thanks for the correction and sorry for the confusion! Anyhow I am trying again.

With synchronized keyword on the method, the default lock is on the current object the method belongs to, with exclusive access to its data. But other threads can execute the same synchronized method on different object instances.

And something like this in a class
private static final Object globalMonitor = new Object();
and synchronized (globalMonitor) {}
is used to prevent concurrent access to the code within the synchronized block, by different threads, even on different object instances. This can be acheived by a static synchronized method too. And as before in addition it locks the current object instance too.

Correct me if I am wrong, Padma
Yes, static variable is accessible by all object instances of the class, think of it as a shared memory between objects of the same class, so static and non-static methods both can access it
Yes, I think you are referring to synchronized method as opposed to synchronized object
Only one thread can work on a synchronized method of a class at a given time, and this method level locking holds true even if the synchronized method is inherited from parent class

Whereas in object synchronization, only the given object is locked, other object instances of same class, parent class, subclass etc, can still be used by different threads
With container managed transactions, rollback should implictly occur when you throw RuntimeException
Make sure that not only the POJO but also the session bean throws back the RuntimeException.

<param name="File" value="/log/test.log"/>


<param name="File" value="C:\\log\\test.log"/>

Both work for us in Windows

11 years ago
<<Name ........... Path
MANIFEST.MF ............ META-INF\
application.xml........... application.xml\

The application.xml should be under folder meta-inf, in which case .ear will appear as:
MANIFEST.MF ............ META-INF\
application.xml........... META-INF\

11 years ago
I agree.
We are using stateless session beans to avail the Container Managed transactions service. This enables us to rollback across multiple data sources

In CMT, we will need to use session beans for components whose atomicity needs to be independent of calling component
In these cases when we are certain it is a local call on same JVM, the business delegate can get handle to local interface rather than remote interface. This should avoid overhead, though I am not certain if this is same as a POJO call

And yes, business delegate is adding a layer of transparency over the ServiceLocator. ServiceLocator will do the jndi lookup, but the Struts controller is still aware of home and remote interfaces, whereas in Business Delegate, the controller is unaware it is talking to session bean

Both the producer and consumer need to know the acknowledgement mode beforehand.

For example if the Producer works with AUTO_ACKNOWLEDGE and consumer is set to be CLIENT_ACKNOWLEDGE, how does the producer know, it has to wait for explicit acknowledgements from consumer?