Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Metamodel not being created until after first use
Metamodel not being created until after first use [message #780991] Tue, 17 January 2012 21:54 Go to next message
Nick Padilla is currently offline Nick Padilla
Messages: 16
Registered: August 2011
Location: New Mexico
Junior Member
I have this setup:

EclipseLink 2.3.2
Dali for generating metamodel classes
Spring 3.1 / Spring 3.1 MVC
Tomcat 7.0.20
Java 1.7


The problem is the first time i use my Metamodel, Account_.id, it is null. This is obviously not correct. Later calls to the same method the Account_.id correctly returns the SingularAttribute. From my understanding it is the responsibility of the JPA implementation to setup the metamodel. If I call persist first then find() I get a correct Account_.id.

Does anyone else have this problem or have seen this problem? It is pretty distinct, here is the stack trace:

Quote:
> java.lang.NullPointerException
> at org.eclipse.persistence.internal.jpa.querydef.FromImpl.get(FromImpl.java:260)
> at com.monstersoftwarellc.testApp.dao.AccountDAO.findAllOrderBy(AccountDAO.java:57)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> at $Proxy19.findAllOrderBy(Unknown Source)
> at com.monstersoftwarellc.virtualvote.HomeController.listUsers(HomeController.java:53)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
> at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
> at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
> at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
> at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
> at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
> at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
> at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
> at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
> at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
> at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
> at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722)


Here you can see the next call works as expected :

Quote:
> Connection(1243367869)--Thread(Thread[tomcat-http--37,5,main])--SELECT ID, VERSION, LOGIN_ID, PERSON_ID FROM ACCOUNT ORDER BY ID ASC


Not sure what the problem is here, but can't have this in production. Any ideas or pointers?

Thanks!
Re: Metamodel not being created until after first use [message #780994 is a reply to message #780991] Wed, 18 January 2012 09:28 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1017
Registered: July 2009
Senior Member
Try the "eclipselink.deploy-on-startup" persistence property. This will help if the problem is that you are accessing the metamodel before the context is deployed, which without the property occurs on first access, not at startup.

Best Regards,
Chris
Re: Metamodel not being created until after first use [message #781011 is a reply to message #780991] Wed, 18 January 2012 09:28 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1017
Registered: July 2009
Senior Member
Try the "eclipselink.deploy-on-startup" persistence property. This will help if the problem is that you are accessing the metamodel before the context is deployed, which without the property occurs on first access, not at startup.

Best Regards,
Chris
Re: Metamodel not being created until after first use [message #781028 is a reply to message #780991] Wed, 18 January 2012 09:28 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1017
Registered: July 2009
Senior Member
Try the "eclipselink.deploy-on-startup" persistence property. This will help if the problem is that you are accessing the metamodel before the context is deployed, which without the property occurs on first access, not at startup.

Best Regards,
Chris
Previous Topic:show parameter values in sql log (no JPA)
Next Topic:Shared cache on multi base using same classes
Goto Forum:
  


Current Time: Fri Aug 22 19:34:52 EDT 2014

Powered by FUDForum. Page generated in 0.01715 seconds