Hi expert,
I am completely new in ORM world.. recently reading mapping specially one-to-many relation. but i am facing some problem to understand.
i am using this link
https://dzone.com/tutorials/java/hibern ... ons-1.htmlplease have a look the code.
Code:
public class Student {
private long studentId;
private String studentName;
private Set<Phone> studentPhoneNumbers
//setter getter
}
public class Phone {
private long phoneId;
private String phoneType;
private String phoneNumber;
//setter getter
}
i understand it.
Real game is here.
Code:
Set<Phone> phoneNumbers = new HashSet<Phone>();
phoneNumbers.add(new Phone("house","32354353"));
phoneNumbers.add(new Phone("mobile","9889343423"));
Student student = new Student("Eswar", phoneNumbers);
session.save(student);
1. why we didn't save here phoneNumbers like session.save(phoneNumbers);
2. once this above code execute then the value will be stored in both table or object(STUDENT and PHONE) right. so how will i store value in only PHONE object. or how will we implement this relation through combobox where user will select STUDENT and fill value in PHONE object not in STUDENT object. then finally save. like product/category.
3.can anyone suggest good tutorial or book where hibernate is implemented in web application. i have seen 99% tutorial explain through console or using main method.
sorry for the poor english.
thanks.