Several questions about nbear

Source: Internet
Author: User
I. How to set the auto-increment of the INT-type primary key fields?
Now the answer is: set this field as the primary key and set only the get attribute.
However, my current requirements cannot be met, or my design is unreasonable. The following describes my design.

, Linkman is shared by apply and course, so I didn't set the contain relationship, but used reverse reference (fkreversequery ). However, it is meaningless for linkman to exist independently, so it does not have to design an independent service class, but is saved as attributes of apply and course when they are saved. Because it is a reverse reference, apply and course respectively store a linkmanid attribute. When applying or course is created, create and save linkman first, obtain the ID of linkman in the database and set its attributes, and then save apply or course itself. Therefore, according to this design, I have to let the primary key ID of linkman increase by itself, but also need it to be configurable. In the current nbear version, I don't know how to do it.

Ii. How to Use transactions?
This is also the demand derived from the above design. When saving, ensure that linkman and apply both succeed or fail at the same time. We can see that nbear has the transaction function, but we don't see any examples.CodeOr instructions, so I hope you can get some advice.

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.