java - LazyInitialization Exception stack trace getting printed even if it is handled in a catch block -
i have code gives me lazyinitialization exception. have handled on demand i.e. catch block gets executed if exception thrown , necessary action taken. though have handled exception stack trace exception getting printed control enters catch block, on console not expected. (since java exception if handled not printed in log file.) below try catch block:
try{ if (tempuser != null) { list<fieldareas> fieldareaslist = tempuser.getfieldareaslist(); (fieldareas fieldarea : fieldareaslist) { fieldarea.getid(); break; } } } catch(lazyinitializationexception exception) { //this catch block written handle lazy initialization exception fetchdetailsformerchant(merchant,defaultpricinginput); tempuser = user.findbyprimarykey(tempuser.getid()); list<fieldareas> fieldareaslist = tempuser.getfieldareaslist(); (fieldareas fieldarea : fieldareaslist) { fieldarea.getid(); break; } }
Comments
Post a Comment