I have a portal w/ multiple portlets that talk to my database. I'm using hibernate 3.2, jboss app server/portal server bundle.
Each page of the portal has between 3 and 7 portlets that each make a call to my single business object which gets 1 hibernate session from the factory PER METHOD and sends it in the constructor of each DAO that I use. The business method starts, then either commits, or rolls back the tx.
If I refresh any portal page multiple times in a row, very quickly, I get "wrong tx on thread" errors. Debugging the output, it seems that under that high concurrency, which i guess really isnt that high, the same TX is attempted to be committed by different sessions.
Is my design sound? Looking for help on how to debug.
Heres a little diagram.. Hope it makes sense.
Portal Page contains [ portletA, portletB, portletC ] each portlet calls a | |--->Business Class [methodA(), methodB(), methodC()] | |--->Various DAOs, each passed a session from prev layer. [DAOa.findbyID(), DAOb.findbyID(), DAOc.findbyID()]