1 error Org. hibernate. mappingexception: unknown entity: COM. PKMs. entity. userat Org. hibernate. impl. sessionfactoryimpl. getentitypersister (sessionfactoryimpl. java: 628) at Org. hibernate. event. def. defaultloadeventlistener. onload (defaultloadeventlistener. java: 91) at Org. hibernate. impl. sessionimpl. fireload (sessionimpl. java: 906) at Org. hibernate. impl. sessionimpl. get (sessionimpl. java: 843) at Org. hibernate. impl. sessionimpl. get (sessionimpl. java: 836) at com. core. hibernate. hibernatedao. get (hibernatedao. java: 39) at com. core. hibernate. hibernatedao. get (hibernatedao. java: 47) at com. core. hibernate. hibernatedao $ fastclassbycglib $ b72f665e. invoke (<generated>) at net. SF. cglib. proxy. methodproxy. invoke (methodproxy. java: 149)
2. Cause
1) cocould not load an entity: [COM. kaisir. server. VO. User #1]
2) There is a syntax error near the keyword 'user.
Because the hibernate-related parts are generated by myeclipse, theoretically there will be no errors from the ing file to VO. Later, after checking, the cause of the error is that "user" is the keyword of SQL Server. Hibernate is not smart enough to add "[]" to the keyword to indicate differentiation.
3. Solution
<Bean id ="Sessionfactory"
Class ="Org. springframework. Orm. hibernate3.annotation. annotationsessionfactorybean">
Add
<Property name ="Packagestoscan"Value ="Com. PKMs .*"/>
@ Table (name = "users", schema = "DBO", catalog = "PKMs ")
Finally, change the database name to t_user.
It turns out to be caused by a conflict with the database keyword. Khan.