Abstractentitytuplizer.createproxy exception Error

Source: Internet
Author: User

Today I tested the SSH framework, but there was a problem, when I loaded an object with Get () there was no exception, but I threw an exception with load (), and the exception was as follows:
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.load (sessionimpl.java:781)
At Org.hibernate.impl.SessionImpl.load (sessionimpl.java:774)
At Org.springframework.orm.hibernate3.hibernatetemplate$3.doinhibernate (hibernatetemplate.java:508)
With this problem, I immediately thought of the difference between load and get when loading data:
1. Load always assumes that the data to be queried exists, and if a record that matches the criteria is not found, the Get method returns NULL, and the load method throws a objectnotfoundexception.
2. The Load method returns the proxy instance of the entity, and the Get method always returns the entity class directly.
3, the Load method can make full use of the first-level cache and level two cache data, the Get method is only in the first level of the cache for data lookup, if not found the corresponding data, will go over the level two cache, directly invoke SQL to complete the data read (after my confirmation, in hibernate3.2 get ( ) method to find the level two cache.
Look at the mistake carefully, think about it should be generated by the proxy class when the error occurred. There are two forms of generation proxy classes in Java, one is Java dynamic Proxy and the other is generated by Cglib. The proxy class for entities in Hibernate is generated with Cglib.
         then carefully studied the jar package, through the jar bag source found that the original is Cglib-2.1.3.jar and cglib-nodep-2.1_3. Jar conflict, only need to remove the Cglib-2.1.3.jar package is no problem. View the source code of Cglib-nodep-2.1_3.jar We also found a problem, It contains all the classes of the Asm-attrs.jar, but the use of the package name is different, do not know if there is no conflict, run the program to view the log, temporarily did not find any problems, keep the Asm-attrs.jar bar.

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.