The message says you are trying to reuse a connection in two different transactions.
Most likely because you are breaking the pooling, e.g. holding the connection in a
i have session bean which is container managed transaction. this session bean calls the entity beans method and another method which executes sql statements. now the method which executes sql statement open another database connection.
here is the method of session bean
entity.findByPrimaryKey --- opens database connection
getDevice() --- opens another database connection
here is the question i have
1) can i change the session bean to bean managed transaction?
2) what the default transaction attribute for container managed transaction?
3) is there any quick fix for this kind of problem with this kind of coding pattern?
Thanks for your reply
Your code shows no pooling.
3) You don't show your database access pattern.
I have resolved this issue. the issue was container configured with no entity bean locking so, two thread tries to access the same entity bean causing this error