-
Example 14
shows the source code for creating a new bean
-
Two basic sections
-
Populate instance data fields
-
Synchronize instance data with DB
-
Starts off with validation (not shown)
-
Checks that bid amount is increasing, etc.
-
Note that the primary key of the Bid is derived from its owner
-
Get owner primary key and extract ID
-
Invoke on user object to allocate an ID (unique to that user)
-
Assuming that User is working properly the primary key for the bid must be
unique
-
Bid also records the item it is a bid on
-
Gets the Item's primary key
-
Stores the primary key fields in its own row
|