开发者

How can I postpone the actual DB insertion of my CMP2.1 bean in JBoss 5.1?

I am migrating a Weblogic 9 application to JBoss 5.1, and bumped into the following p开发者_如何转开发roblem:

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.

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.

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.

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?

Thanks for your help :)


This was done by using the cmp2.x jdbc2 configuration, in standardjboss.xml, with insert-after-ejb-postprocess set to false.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜