Please tell me whether the data will get deleted in the database on calling the remove() on the collection returned in the EntityBean below.
public abstract class CustomerBean implements javax.ejb.EntityBean {
...
public void addPhoneNumber(
String number, byte type)
throws NamingException, CreateException {
InitialContext jndiEnc = new InitialContext();
PhoneHomeLocal phoneHome = (PhoneHomeLocal)
(jndiEnc.lookup("PhoneHomeLocal"));
PhoneLocal phone = phoneHome.create(number,type);
Collection phoneNumbers = this.getPhoneNumbers();
phoneNumbers.add(phone);
}
public void removePhoneNumber(byte typeToRemove) {
Collection phoneNumbers = this.getPhoneNumbers();
Iterator iterator = phoneNumbers.iterator();
while(iterator.hasNext()){
PhoneLocal phone = (PhoneLocal)iterator.next();
if (phone.getType() == typeToRemove) {
phoneNumbers.remove(phone); break;
}
}
}
public abstract java.util.Collection getPhoneNumbers( );
public abstract void setPhoneNumbers(java.util.Collection phones);
}