Malar Sundar

Greenhorn
+ Follow
since May 22, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Malar Sundar

Hi,
Import the jar file into the Ear project (directly under the Ear folder). Set the properties of your Web Project to point to this jar file. (Web Project --> Properties --> Java Build Path and Libraries tab click Add Jars button and point to the jar file from the Ear project)
Hope this helps...
Malar.
21 years ago
Hi,
That is not true. You can give any data type (like String, Date, Timestamp, etc). I had done it before with String and Date object types as input to finder methods.
If you can post the error message, I can tell you more. Make sure your data type mappings are correct. For long java type, the correct sql type is BIGINT (in DB2). Check it for your DB...
Thanks,
Malar.
21 years ago
Hi,
Sure, you can deploy J2EE 1.2 Enterprise applications in WAS 5.0 server.
21 years ago
Hi,
Let me elaborate...
The Session bean has 3 methods method a(), b(), and c(). To group all these three methods in a usecase, you should also have a seperate method, say x() in the same Session bean (or you can have it in other Session bean also, in that case methods a, b, and c will be called from that bean. For simplicity let it be in the same bean itself, for our discussion)
Transaction attributes:
method x() - Required
method a() - Required
method b() - RequiresNew
method c() - Required.
With this setup, if you invoke method x() on the session bean, a new Transaction(say T1) is started. now method a() will use the same tranaction (T1). For method b() a new Transaction (T2) will be created and T1 will be suspended. When method b() completes, the container commits or rollback the transaction T2, and T1 resumes. So now method c() uses T1 for it's processing.
Be sure to handle the exceptions correctly...
method x()
{
try {
a(); // uses Tx T1...
b(); // creates new Tx T2...
c(); // uses Tx T1...
}
catch(Exception e)
{
// notify the container to rollback the Tx
getSessionContext().setRollbackOnly();
}
}
follow the same way for every method...
Hope this helps...
Thanks,
Malar.
Hi,
You can achieve this by setting the transaction attribute for the method responsible for 'process b' as
<trans-attribute>RequiresNew</trans-attribute>
in the deployment descriptor of your session bean...
Thanks,
Malar.
Hi,
You need to handle the exceptions in your session bean method...
Put the code in try block and catch Throwable or Exception and call setRollbackOnly() method on the SessionContext object. So whenever there is an exception, your container knows to rollback or commit them as whole...
public method()
{
try{
//call other bean methods here...
}
catch(Throwable t)
{
//mark the transaction to rollback...
getSessionContext().setRollbackOnly();
}
}
Hope this works fine...
Thanks,
Malar.
21 years ago
Hi,
You should handle exceptions and mark the transaction to rollback, so that the container knows whether to commit or rollback.
// session bean method...
methodA() throws Exception
{
try {
// call b.remove();
// call a.remove();
}
catch(Throwable t)
{
getSessionContext).setRollbackOnly);
// throw new Exception(t.getMessage());
// or throw your application exception...
}
}