Line 01 | ejbCreate() is invoked by the container on receipt of the invocation of the corresponding create() on the home object. It throws a CreateException and returns the primary key, a String in this case.
|
Lines 03-08 |
Verifies that the arguments are valid for the persistence object. If they are not, then it throws a CreateException. In this case, the code verifies that the argument is a valid integer carried in the String using the Integer.parseInt() .
|
Lines 10-14 |
The code tries to create a new row using the insertRow() black box method that contains JDBC code.If the row cannot be inserted, insertRow() (probably) throws a SQLException.As the client has no business knowing how the bean does its job, it throws an EJBException to report that there was a problem. EJBException is not a checked exception, so it can be thrown without being declared. The information from the downstream exception is wrapped in the EJBException. |
Lines 16-17 | The instance variables, which represent the entity, are initialized to the newly created entity object. |
Line 18 | The method returns a fully initialized primary key. |