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 #781008] Wed, 18 January 2012 02: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 #845410 is a reply to message #781008] Sun, 15 April 2012 03:08 Go to previous message
Michael Mok is currently offline Michael Mok
Messages: 1
Registered: April 2012
Junior Member
Hi Nick

I do not have an answer to your query. But can you provide your spring context.xml as we are having problems trying to insert a new object using Spring 3.1, Eclipselink 2.3 and MySQL. The error we found is



java.lang.IllegalArgumentException: Object: com.greenpower.bean.BaseProduct@5e0eb724 is not a known entity type.
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4158)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:440)
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.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)


Previous Topic:Running JPA 1 & 2 in same Process
Next Topic:Constraint violation orphan removal / cascade
Goto Forum:
  


Current Time: Thu Oct 23 20:34:23 GMT 2014

Powered by FUDForum. Page generated in 0.01710 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software