For a session bean, only the methods in the component interface are transactional, you need to mark them with a transaction attribute if you are using CMT. The home interface methods like create are non-transactional. Hence the container would run them in an Unspecified Transaction Context. The rule is that if a method runs in an Unspecified Transaction Context, then you cannot call context.setRollbackOnly() and context.getRollbackOnly() i.e. ask the container to rollback the transaction or check to see if it is rolled back. Doing so will throw an IllegalStateException. But if you are using BMT, you are free to get the UserTransaction reference and start your own transaction. This will be clearer after you read the transactions chapter.
posted 11 years ago
Thanks - that makes perfect sense!!
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads