Use of XDoclet in hibernate

Source: Internet
Author: User
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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.