0 Replies Latest reply on Jan 24, 2003 2:35 AM by Gianluca Chini

    PROBLEMS WITH UNIQUE FIELDS AND TRANSACTIONS

    Gianluca Chini Newbie

      Hi, I'm using JBoss 3.0.2 with CMP and I have problems with unique fields. I wrote a session method that saves data from a data transfer object to an entityt bean. I don't want to control if the data on certain fields are unique because the RDBMS (Oracle 8.1.7) do this.
      When the method does an insert i have no problems and I'm able to catch the exception (thrown by the create method).
      But when the methods does the update JBoss throws a TransactionRolledBackException at the end of the business method and the whole method fails..

      The solution I've adopted is to create another session in a new transaction and save the data with this, so I can control the exception.

      The transaction attribute for entity beans is mandatory and for the session beans required.

      Is this correct, there are more convenient solutions??