Hibernate class: @ hibernate. Class
Table = "teacher" hibernate subclass: @ hibernate. Joined-subclass
@ Hibernate. Joined-subclass-Key
Column = "tea_id" primary key: @ hibernate. ID
Column = "tea_id"
Generator-class = "native" common property: @ hibernate. Property
Column = "tea_name" 1: n (1 to many) one end of 1:
@ Hibernate. Set
Lazy = "true"
Cascade = "all"
Inverse = "true"
@ Hibernate. Collection-keycolumn = "tea_id"
@ Hibernate. Collection-one-to-manyclass = "TMS. Teacher. zbjiangcheng"
Multiple ends:
@ Hibernate. Allow-to-one
Column = "tea_id"
Class = "TMS. Teacher. zbteacher"
Not-null = "true" (1 to 1) one end of 1:
@ Hibernate. One-to-one name = "gongzi"
Class = "TMS. Teacher. zbgongzi"
Cascade = "all"
The other end of 1:
@ Hibernate. One-to-one
Name = "teacher"
Class = "TMS. Teacher. zbteacher"
Constrained = "true"
And its primary key policy should be:
@ Hibernate. ID
Column = "tea_id"
Generator-class = "foreign"
Unsaved-value = "0"
@ Hibernate. Generator-Param
Name = "property"
Value = "teacher"
Another type of 1-1 relationship maintained by one end
(For example, a book corresponds to a book type, a book type corresponds to multiple books, and one end of the book type does not need to maintain the corresponding books, and the other end of the book should maintain the corresponding types of books) @ hibernate. allow-to-one
Name = "booktype"
Column = "booktype_id"
Cascade = "all"
Not-null = "true"