Org.hibernate.LazyInitializationException:could not initialize Proxy-no SessionError when using hibernate to delay loading because the session was closed earlyWorkaround 1, do not use LAZY, that is @onetoone (Cascade=cascadetype.all, Fetch=fetchtype.
Error page TipsCould not initialize Proxy-no SessionControl DeskOrg.hibernate.LazyInitializationException:could not initialize Proxy-no SessionIllness: This is a lazy use of the exception, using a late load, in the session (Hibernate session),
Hibernate has the following exceptions:
Exception in thread "Main" org. hibernate. hibernateexception: No session currently bound to execution Context
At org. hibernate. Context. managedsessioncontext. currentsession (managedsessioncontext. Java: 7
Org. hibernate. LazyInitializationException cocould not initialize proxy-no Session solution, hibernate. initializeMethod 1: configure the filter to disable the session with a delay in web. xml.
opensession org. springframework. orm.
Method One: In the Web. XML configuration delay Close Session filter - filter> filter-name>Opensessionfilter-name> filter-class>Org.springframework.orm.hibernate4.support.OpenSessionInViewFilterfilter-class>
Today in the testing of the company's app found such a problem, in the app call Webapi when the session is not read, on-line check a bit of a similar problem, decisive record down.Demand:1, the app in the change password when there is a process of
The following error occurred: Org.hibernate.LazyInitializationException:could not initialize proxy-no SessionThe reason is lazy loading problem, because hibernate mechanism is when we query an object, by default, the return is only the ordinary
Locate the project's application configuration file, add Spring.session.store-type=none, restart the problem resolutionNote: Because the project does not use the Redis management session, you can set it up, if you want to use the Redis management
Related Code Link: http://git.oschina.net/alexgaoyh/alexgaoyh Last week when writing Hibernate4 code, an exception org.hibernate.LazyInitializationException:could not initialize Proxy-no The most likely solution to the Session online is
Abnormal:
Org.hibernate.LazyInitializationException:could not initialize Proxy-no Session
When doing a project encountered this problem, the approximate meaning is not initialized, the session closed, and then thought may be the session closed and
Today, while learning hibernate, the following error occurred:Error Analysis:If we take a single object with the Get method there is no problem, but if the object we are fetching has an associated object, it is problematic with get, because it does
Failed to lazily initialize a collection of Role: COM. Bubble. entity. datas. Days, no session or session was closed
The relationship between the datas class and the day class is one-to-many!
When querying the datas class, retrieve the set of
This can be seen literally: initialization is not allowed, and there is no session. The main reason is that the session is closed.
In Hibernate, lazy in is a proxy by default. In this way, hibernate does not associate data queries in the
When learning to write OA permission management, obtain all the sub-modules of this module through the obtained parent module on the JSP page.
JSP code snippet:
$ {Child. name}
Java code:
@ Onetoworkflow (mappedby = "parent "
@ Manytoone (fetch = fetchtype. Lazy)
Exception in lazy loading: org. hibernate. lazyinitializationexception: cocould not initialize proxy-No session
I thought it was my configuration problem. I tested it for a long time and found the problem:
Original http://blog.csdn.net/skmbw/article/details/12650827
Fastjson serialization Hibernate proxy and deferred load object appears org.hibernate.LazyInitializationException:failed to lazily initialize a collection of
The project uses the spring boot build, provides the restful interface to the PHP invocation, the interface class unifies uses the @restcontroller annotation
Entity relationships
@ManyToOne (fetch = Fetchtype.lazy)
@JoinColumn (name =
The thinkphp framework used by {code...} has just been discussed in tp and won't work after trying it. I don't quite understand how it can be regarded as a login verification. Example code ..htm (www.edbiji.comdoccentershowdoc54nav702.html),
Recently, when the customer mentioned the problem, they found that lazy was not properly designed.
After checking, you can set the class or set to lazyfalse on the Internet.
But the problem is not solved.
Later, we found that you can configure
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.