0 Replies Latest reply on May 16, 2003 6:02 AM by George Tavares

    Problem with BMT, Entity and JDBC

    George Tavares Newbie

      I have a project using Jboss 3.0.6 that has two entity beans with a many to many CMR between them. I am trying to use these Entity Beans in a Stateful Session Bean with Bean Managed Transaction. What I am trying to do is this:

      1) Get and begin the UserTransaction
      2) Find 2 Entity Bean
      3) Make a relation between these entity beans
      4) Make a JDBC Connection Call, direct, with a DAO, in the CMR table (many to many)
      5) commit

      I am using BMT because this operation occours across some methods.

      In the item 4 that occours the problem. The ResultSet doesn't have the relation in the database applied. The connection is in the same transaction.
      Then I start investigate the problem, using a sql logger (P6Spy) and I discover that the INSERT is generated to the database only when I was going to commit the transaction.

      I make a search and discover that if I used commit-option A and use of direct JDBC (even within JBoss) will result in an inconsistent database state. I put all of them to type C and the problems stay the same. Also the option sync-on-commit-only is false. The INSERT statement is generated only in commit. I need that it must be generated before, to the JDBC call take a correct snapshot of the relation table.

      How can I solve this?