CMP's ejbPostCreate: record not persisted
posted 9 years ago
The application that I'm debugging is inserting a record into a table (say Table A) and inserted some related data into a related table (say table B). Table A is implemented with a CMP entity bean. Now the ejbPostCreate method is written to write to table B by calling some utility class(does not use entity bea). This technique is a simple one that I've found examples for on the web. However, in our application when table B is being inserted into, I'm getting a Oracle database error saying that that the FK cannot be found. This FK is the PK in table A. So what this means to me is that in the ejbPostCreate method, the insert is not committed and was inserted in a different database session, if it was inserted at all. I should point out here that the CMP Entity does work for the overloaded ebjCreate/ejbPostCreate methods that insert a Table A record with no related tables. This behavior contradicts all of the promised behavior that I've found on the Web. Does anybody have any insight into what might resolve this issue(xml configuration perhaps)?