A solution for org. hibernate. tuple. abstractentitytuplizer. createproxy errors (http://www.blogjava.net/tantanxiaos

Source: Internet
Author: User

When integrating the three SSH frameworks, Hibernate can control the relationship between tables. However, the configuration is slightly neglected and prone to errors. The following code is used. I didn't set the foreign key relationship in the database, but wanted to control it through hibernate. There were two tables, column table (LM) and Course table (KC). They were multi-to-one. Therefore, in the LM pojo class, set public class lm implements java. Io. serializable {// column ID private int ID; private string name; private KC; // order
Private int location; // getter and setter Methods}

The LM. HBM. xml ing file is configured as follows to deploy and run. The following error is displayed:

Hibernate: Select lm0 _. ID as id5 _, lm0 _. name as name5 _, lm0 _. kcid as kcid5 _, lm0 _. location As location5 _ from eteares. lm lm0 _ Where lm0 _. kcid =? 0:35:48 org. Apache. Catalina. Core. standardwrappervalve invoke severe: servlet. Service () for servlet default
Threw exception Java. lang. nullpointerexception at Org. hibernate. tuple. abstractentitytuplizer. createproxy (abstractentitytuplizer. java: 372) at Org. hibernate. persister. entity. abstractentitypersister. createproxy (abstractentitypersister. java: 3121) at Org. hibernate. event. def. defaultloadeventlistener. createproxyifnecessary (defaultloadeventlistener. java: 232)
At Org. hibernate. event. def. defaultloadeventlistener. proxyorload (defaultloadeventlistener. java: 173) at Org. hibernate. event. def. defaultloadeventlistener. onload (defaultloadeventlistener. java: 87) at Org. hibernate. impl. sessionimpl. fireload (sessionimpl. java: 862)
At Org. hibernate. impl. sessionimpl. internalload (sessionimpl. java: 830) at Org. hibernate. type. entitytype. resolveidentifier (entitytype. java: 266) at Org. hibernate. type. entitytype. resolve (entitytype. java: 303) at Org. hibernate. engine. twophaseload. initializeentity (twophaseload. java: 116)
At Org. hibernate. loader. loader. initializeentitiesandcollections (loader. java: 842) at Org. hibernate. loader. loader. doquery (loader. java: 717) at Org. hibernate. loader. loader. doqueryandinitializenonlazycollections (loader. java: 224) at Org. hibernate. loader. loader. dolist (loader. java: 2145)
At Org. hibernate. loader. loader. listignorequerycache (loader. java: 2029) at Org. hibernate. loader. loader. list (loader. java: 2024) at Org. hibernate. loader. hql. queryloader. list (queryloader. java: 375) at Org. hibernate. hql. ast. querytranslatorimpl. list (querytranslatorimpl. java: 308)
At Org. hibernate. engine. query. hqlqueryplan. performlist (hqlqueryplan. java: 153) at Org. hibernate. impl. sessionimpl. list (sessionimpl. java: 1106) at Org. hibernate. impl. queryimpl. list (queryimpl. java: 79) at Org. springframework. orm. hibernate3.hibernatetemplate $29. doinhibernate (hibernatetemplate. java: 849)
At org.springframework.orm.hibernate3.hibernatetemplate.exe cute (hibernatetemplate. java: 372) at Org. springframework. orm. hibernate3.hibernatetemplate. find (hibernatetemplate. java: 840) at Org. springframework. orm. hibernate3.hibernatetemplate. find (hibernatetemplate. java: 836)
At cn.edu. ujn. wsjx. dao. impl. lmdao. findbycourse (lmdao. java: 74) at cn.edu. ujn. wsjx. managecolumn. service. impl. columnservice. getcolumnbycourse (columnservice. java: 56) at cn.edu. ujn. wsjx. managecolumn. action. columnaction. browsecolumn (columnaction. java: 59) at Sun. reflect. nativemethodaccessorimpl. invoke0 (native
Method) at Sun. Reflect. nativemethodaccessorimpl. Invoke (unknown source) at Sun. Reflect. delegatingmethodaccessorimpl. Invoke (unknown source)

After diagnosis, this is a problem with hibernate settings, because the default lazy attribute is true, that is, lazy loading is used, and the database is loaded only when the attribute of this object is used. Therefore, add lazy = "false" to the tag"

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.