Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why i can't see transaction for ejb.  RSS feed

 
liang sun
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in ejb's method, i have a program using JDBC API.
ejb'method's transaction attribute is "required" as default.
It is container managing transaction bean.
try
{
.......
Statement s=con.createStatement()
s.execUpdate("sql1 "); //sql1 is correct "insert into.."
s.execUpdate("sql2"); //sql2 is false "insert into."
}
catch(Exception e)
{
throw new EJBException();
}
when executing, client program received ejbException from ejb.
but "sql1"'s executing result reflect to Database though "sql2"
execute failure��
why contain's transaction don't work?(in session bean and entity bean'S attempting result is same)
pls give me some advice or material
thanks
 
Ram Dhan Yadav K
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before throwing ejb exception, you should use
setrollbackOnly()
in your code.
Ramdhan YK
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!