Hi Guys,
Thanks for the response.
@Rajeev - Not yet mate am still looking at the issue when I do will update this post or if you get any answers would be good to learn from that. I also seem to be getting a related exception now, not sure if this is a related one as yet will describe it in a moment. Just a quick one, would like to know what framework your using for UI Wicket?
@Winterer: - I think you have a strong point there. That was my understanding that once it renders OSVF closes the session that is correct, however when we navigate on the front end at present I do not load the entities from the back-end instead I resort to pulling that information from the Model class in wicket .i.e a Value Object that contains the result set that was fetched. It make sense in my use case that I don't want to pull it from backend here just as yet, will explain why later but yeah I see your point there, .i.e the child association will not be able to get the values..however, since I manually have iterated/initialised it the VO should still have those values isn't it?
Now here is something I noticed with some changes.
Refer to the Person class it contains a Collection of Phone i.e Set<Phone>, the Phone entity has a PhoneType entity that is mapped as @ManyToOne like so:
Code:
public class Phone{
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PHONE_TYPE_KEY")
public PhoneType getPhoneType() {
return this.phoneType;
}
}
On the front end I commented out the code that renders the
PhoneType as part of the Phone Listing and the Java code equivalent in Wicket.
Now when I run, there is no LazyInitializationException, that kinda stumps me. So since the Set<Phone> was initialized manually in the backend DAO by iterating the collection and setting it into an ArrayList, it has initialized it.
However, the Phone.PhoneType seems to throw this exception and guessing this is/was the object that has caused this issue.
Now given that I have commented all this out and
navigating the Phones does not throw LIE, I now noticed that after sometime I repeat a search operation by canceling from the Detail Page/Panel. When i clicked on the Search button I got a ( please bear with me).
Code:
WARN - JDBCExceptionReporter - SQL Error: 17002, SQLState: null
ERROR - JDBCExceptionReporter - Io exception: The Network Adapter could not establish the connection
WARN - JDBCExceptionReporter - SQL Error: 17002, SQLState: null
ERROR - JDBCExceptionReporter - Io exception: The Network Adapter could not establish the connection
ERROR - RequestCycle - Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy22.getStudy(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
at org.apache.wicket.proxy.$Proxy29.getStudy(Unknown Source)
at au.org.theark.study.web.component.subject.Search$1.onSearch(Search.java:87)
I guess for some reason the backend or the connection has dropped, or has the program forced it to drop the connection by not having enough resource? Don't know why this is occuring. The other part is...having to fetch from backeend for each navigation and render the phoneType.
Thanks again let you know how it goes
Cheers