Analysis:
Contact and customer is many to one, a customer (company) has multiple contacts, on the more this side, namely Linkman,
1, Linkman.java In addition to their own attributes, but also need
2. In the Hbm.xml file, add
This means that a foreign key is established to maintain the relationship, the column name is lkm_cust_id, the referenced property name is the customer object defined in Linkman.java, and the class of the object is Customer.java
Realize:
1. New Addlinkmanservlet
2. New service and Impl
3. DAO and Impl,customerdao Add GetByID method
The ID information of the customer submitted by table dropdowns is encapsulated into the Linkman object, the customer object is obtained through the client's ID in Serviceimpl, the acquired customer object is saved to the Customer object in the Linkman object, and finally, Saved to the database through the DAO layer implementation.
Hibernate_ Adding a contact practice