1. Provide a parameterless constructor: All persisted classes should provide a parameterless constructor, which may not take the public access control. Hibernate can use Constructor.newinstance () to create an instance of a persisted class as long as the parameterless constructor is provided. Typically, for hibernate to generate proxies at run time, the constructor's access control modifier is at least the package courseware, and is greater than or equal to the default access control character.
2. Provide an identity attribute: The host field that identifies the attribute that typically maps a database table. This property can be called any sensible, and its type can be any basic type, basic type of wrapper type, java.lang.String or java.util.Date. If you use a federated primary key for a database table, you can even use a user-defined class that uses these types of properties. Of course, instead of specifying any identity attribute, you can map multiple normal properties directly to a federated primary key in persisted annotations, but this is not usually recommended.
Tips:
Although hibernate allows you to use the basic type of 8 as the Identity property Hu type, this is not convenient in many places, so it is recommended to use the base type wrapper type as the type of the identity attribute.
5--Basic usage of Hibernate--5 1 requirements for persistence classes