打开JPA:MetaDataException升级到Open JPA 2.4.1& Java 8

时间:2016-08-24 13:55:12

标签: java jpa openjpa

我将我的java应用程序升级为Open JPA 2.4.1& Java 8&我得到以下错误。以前我在Open JPA 2.2.2& Java 7.注意,错误文本“目标在表中不存在”不正确,该字段在表中。

有什么想法?

<openjpa-2.4.1-r422266:1730418 fatal user error> org.apache.openjpa.util.MetaDataException: "com.test.app.persistence.TblfeeFeeDtl.tblfeeFee" defines a target of "pay_id" for column "pay_id", but that target does not exist in table "dbo.tbl_sfee_fee".
org.apache.openjpa.jdbc.meta.MappingInfo.mergeJoinColumn(MappingInfo.java:1543)
org.apache.openjpa.jdbc.meta.MappingInfo.createJoins(MappingInfo.java:1323)
org.apache.openjpa.jdbc.meta.MappingInfo.createForeignKey(MappingInfo.java:1085)
org.apache.openjpa.jdbc.meta.ValueMappingInfo.getTypeJoin(ValueMappingInfo.java:115)
org.apache.openjpa.jdbc.meta.ValueMappingInfo.getTypeJoin(ValueMappingInfo.java:92)
org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.map(RelationFieldStrategy.java:166)
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:148)
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:81)
org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:498)
org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:463)
org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.map(RelationToManyInverseKeyFieldStrategy.java:135)
org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.map(RelationCollectionInverseKeyFieldStrategy.java:94)
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:148)
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:81)
org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:498)
org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:463)
org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:854)
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1813)
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:829)
org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:784)
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:664)
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:418)
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:389)
org.apache.openjpa.persistence.meta.MetamodelImpl.<init>(MetamodelImpl.java:86)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:348)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.getCriteriaBuilder(EntityManagerFactoryImpl.java:332)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:462)
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:633)
com.sun.proxy.$Proxy63.getCriteriaBuilder(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:226)
com.sun.proxy.$Proxy88.getCriteriaBuilder(Unknown Source)
com.test.app.DataBCImpl.getTblPpwsUserGroupDtls(PricingDataBCImpl.java:3078)
com.test.app.DataBCImpl$$FastClassBySpringCGLIB$$99f8efb3.invoke(<generated>)
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:52)
org.springframework.cache.interceptor.CacheAspectSupport.invokeOperation(CacheAspectSupport.java:345)
org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:414)
org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:327)
org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
com.test.app.DataBCImpl$$EnhancerBySpringCGLIB$$1735a68a.getTblPpwsUserGroupDtls(<generated>)
com.test.app.common.RoleMapperGrantedAuthorityFactory.createGrantedAuthority(RoleMapperGrantedAuthorityFactory.java:36)
waffle.spring.WindowsAuthenticationToken.<init>(WindowsAuthenticationToken.java:84)
waffle.spring.NegotiateSecurityFilter.doFilter(NegotiateSecurityFilter.java:108)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。 &#34; tblfeeFee&#34;的映射下面列出的表是问题。所讨论的领域是多列FK关系的一部分。出于某种原因,Open JPA 2.4.1比以前的版本更加挑剔。我需要在此表的映射中明确定义相关字段。

com.test.app.persistence.TblfeeFeeDtl.tblfeeFee defines a target of "pay_id" for column "pay_id", but that target does not exist in table "dbo.tbl_sfee_fee".