java - Why use @Transactional Jboss Seam -


i'm trying understand why need use @transactional in cases, let's see.

if use method without @transactional annotation jboss return on log: "close connection yourself. closing connection you".

public void dosomething() {          ((session) em.getdelegate()).dowork(new work() {             @transactional(transactionpropagationtype.never)             public void execute(connection connection) throws sqlexception {                 stringbuilder sqlsp = new stringbuilder();                 sqlsp.append("{ call ");                 sqlsp.append("myprocedure");                 sqlsp.append("(?)}");                  connection.setreadonly(true);                 callablestatement cs = connection.preparecall(sqlsp.tostring());                  cs.setint(1, 1020);                              cs.execute();                  //force exception , jboss show "closing connection you"                 throw new myexception("fatal error");             }         });     } 

but when put "@transactional" problem disappear, don't understand why. can explain ?

standard way of handling db calls : 1. open connection 2. open session and/or transaction 3. stuff 4. close transaction and/or seasion 5. close connection

that's basicly annotation ;) suggest learn more dealling kind of things.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -