I have a SessionBean with a 'required' transaction attribute that creates two local EntityBeans.
I choose to have an empty create method on the local beans and set the values directly using the mutators. The example below explains:
ejb1.create();
ejb1.setValue1();
ejb1.setValue2();
ejb2.create();
ejb2.setValue1();
ejb2.setValue2();
Let's say property ejb1.value1 is required in the database (i.e. not null). Since all of the calls are within the same transaction I should be able to successfully execute this method, right?
The database is saying value1 is a required field when I call the create() method. The primary key is being inserted without value1. Shouldn't all the fields be inserted upon committing the transaction hence not throwing a required field exception?
I am using JBoss3.0.3_Tomcat4.0.5 with MySQL 4.0.12 (mysqld-max) and INNODB tables with the MySQL Connector/J 3.07.
I believe transactions are working since the rollbacks have proven successful (i.e. when I make ejb2.value1 required, ejb1 does not remain in the database).
Mostly curious at this point.