Hi,

I am reading the Valesky book "Enterprise JavaBeans" and after reading pp 98 and 
looking at the newCustomer example code (pseudocode below) I am confused. It the 
discussion it says that a TRANSACTION_SERIALIZABLE isolation level will be used for 
this code so that the method cannot be called by two people at the same time. However, 
it seems to me that it is still possible to end up with corrupt data unless this 
transaction level is applied to the database. I have created a new method (below) 
called addFamilyMember as an example. If the transaction isolation is at the method  
level, then newCustomer and addFamilyMember could execute at the same time and may 
attempt to create users with the same ID? I must be missing something here - please 
help...



int newCustomer( name, address) {
    get connection
    get maxID
    create customer with maxid + 1
     close statements/connection
    return new customerid

}



int addFamilyMember(name, existingCustomerID) {
    get connection
    get Existing address
    get maxID
    create customer with maxid + 1
    close statements/connection
    return new customer id
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to