title: How can I postpone the actual DB insertion of my CMP2.1 bean in JBoss 5.1?
body: <p>I am migrating a Weblogic 9 application to JBoss 5.1, and bumped into the following problem:</p>
  
  <p>A session ejb manages CMP 2.1 entities. Those are inserted at the time of the call to MyEntityLocalHome.create() method. Since the database table has "not null" constraints, some of the fields, who are normally set after the call to the create() method, are not set and the insertion fails.</p>
  
  <p>I know that if the manager called a create(myNotNullField); method, passing the correct parameters, the problem would be solved. Unfortunately, the manager uses a layer that discovers at runtime which *LocalHome and which create() method should be called (by introspection) and the create method is discovered using the PK fields of the entity. That means that the layer cannot find create() methods with parameters that are not a part of the PK.</p>
  
  <p>In the JBoss docs, I found a parameter (insert-after-ejb-post-create) that allows me to postpone the insertion after the ejbPostCreate(...) method, but that doesn't solve my problem either, since the "LocalHome.create() call still returns after the DB insertion.</p>
  
  <p>How can I delay the actual insertion in the DB to the end of the transaction, so that the manager can set the "not null" fields? Since the app works in Weblogic 9, I guess that such an option exists in WLS... does this parameter exists in Jboss 5.1?</p>
  
  <p>Thanks for your help :)</p>