I am testing the container transaction on JBoss, but no success so far. What's the typical way to test transaction feature with J2EE? I want to make sure roll back successfully is happened in my system in certain conditions.
I'd use a JUnit test case. Start a user transaction that runs your code that causes a rollback, and check the results outside the rollback.
If you want to cause a random rollback, add an interceptor the the ejb invocation stack that randomly causes a rollback.