I add contact records
then i want to add phones and addresses records
do i use only the "create" method defined in LocalAddressHom e and in LocalPhoneHome
the relationship between ContactBean and PhoneBean is one to many the same with addresses the referencing field from ContactBean to PhoneBean is "phones" a collection and from ContactBean to AddressBean is "addresses" a collection
Does the contactID go to the database when i invoke "create" method of LocalAddressHom e or LocalPhoneHome
my interfaces
LocalAddressHom e:
LocalPhoneHome:
Code:
try {
InitialContext ic = new InitialContext();
Object objContactBean = ic.lookup("java:comp/env/ejb/ContactRef");
LocalContactHome contactHome = (LocalContactHome) objContactBean;
contactHome.create("01", "Andrzej", "Miążek","andrzej_miazek@op.pl");
contactHome.create("02", "Michał", "Kacper","michal_kacper@op.pl");
contactHome.create("03", "Aleksandra", "Owczarek","aleksa1981@wp.pl");
contactHome.create("04", "Krzysztof", "Żak","zaczek@poczta.onet.pl");
contactHome.create("05", "Oskar", "Paprocki","oskarek1984@qmail.com");
} catch(Exception e) {
e.printStackTrace();
out.println("Create Contacts Failed : " + e.toString());
}
do i use only the "create" method defined in LocalAddressHom e and in LocalPhoneHome
the relationship between ContactBean and PhoneBean is one to many the same with addresses the referencing field from ContactBean to PhoneBean is "phones" a collection and from ContactBean to AddressBean is "addresses" a collection
Does the contactID go to the database when i invoke "create" method of LocalAddressHom e or LocalPhoneHome
my interfaces
LocalAddressHom e:
Code:
public interface LocalAddressHome extends EJBLocalHome {
public LocalAddress create (
String contactID,
String addressID,
String street,
String city,
String zip,
String country)
throws CreateException;
public LocalAddress findByPrimaryKey(String addressID)
throws FinderException;
}
Code:
public interface LocalPhoneHome extends EJBLocalHome {
public LocalPhone create (
String contactID,
String phoneID,
String phone)
throws CreateException;
public Collection findAllPhones ()
throws FinderException;
public LocalPhone findByPrimaryKey(String phoneID)
throws FinderException;
public Collection findByContactID(String contactID)
throws FinderException;
}
Comment