When hibernate is mapped to a database, @ ManyToOne and @ onetoworkflow

Source: Internet
Author: User

The first time I used hibernate to automatically generate a table that involves foreign keys for multiple tables, I encountered several errors using the @ onetoworkflow and @ ManyToOne annotations.

First, declare a base. There is no need to correspond one-to-one annotations @ onetoworkflow and @ ManyToOne.

First question: What is the difference between @ onetoworkflow and @ ManyToOne?

When @ ManyToOne is used, such as the project manager class and the programmer class, a Project Manager manages multiple programmers,

That is, the field "mid" is generated in the t_programmer table corresponding to this Programmer ";

The @ onetoworkflow annotation is in

The field "mid" is generated in the t_programmer table. Multiple programmers correspond to one project manager.

It is worth mentioning that when @ onetoworkflow is used, Set <> j Set is required. Otherwise, an error is returned.

These are basic things. I forgot to take a look at them at any time.

Related Article

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.