Hibernate self-growth field configuration

xiaoxiao2021-03-06  124

The younger brother recently encountered a question when you do a project is the configuration of the self-growth field in Hibernate, not self-growth primary key. After the unremitting efforts of the younger brother, finally, listen to the younger brother slowly:

In fact, it is very simple to set the self-growth field to the primary key in the configuration file.

example:

Database structure:

ID INT has grown, step size is 1

Nickname Varchar PRIMARY Key

How does the Hibernate object write me? Below is the configuration file:

The above is configured to run on the SQL2000.

In fact, there are many ways to deal with this situation, and the generated key mode is a good way, the younger brother is in order to lazy, I want to have such a dirt-of-Chinese method ^ _ ^. If you have any wrong places, please ask your guidance.

QQ: 316853067

转载请注明原文地址:https://www.9cbs.com/read-99299.html

New Post(0)