Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Hibernate@Filter注释不能与WebSphere共享库一起使用?_Hibernate_Websphere 8_Hibernate Filters - Fatal编程技术网

为什么Hibernate@Filter注释不能与WebSphere共享库一起使用?

为什么Hibernate@Filter注释不能与WebSphere共享库一起使用?,hibernate,websphere-8,hibernate-filters,Hibernate,Websphere 8,Hibernate Filters,我们正在WebSphere中部署Spring+JPA+Hibernate web应用程序。在该应用程序中,我们将所有hibernate模型对象打包为一个单独的jar文件,并保留为一个共享库引用。我们的模型对象是基于注释的实体类 我们面临的问题是除了@org.hibernate.annotations.Filter、FilterDefs注释之外,所有注释都工作正常。当我调用session.enableFilter(“activeRecordFilter”)我得到一个异常,如: org.hibern

我们正在WebSphere中部署Spring+JPA+Hibernate web应用程序。在该应用程序中,我们将所有hibernate模型对象打包为一个单独的jar文件,并保留为一个共享库引用。我们的模型对象是基于注释的实体类

我们面临的问题是除了
@org.hibernate.annotations.Filter
、FilterDefs注释之外,所有注释都工作正常。当我调用
session.enableFilter(“activeRecordFilter”)我得到一个异常,如:

org.hibernate.HibernateException: No such filter configured [activeRecordFilter]
我们的模型对象定义如下

@javax.persistence.Entity
@org.hibernate.annotations.FilterDef(name = "activeRecordFilter", defaultCondition =     "ACTV <> 'N'")
@org.hibernate.annotations.Filter(name = "activeRecordFilter")
@javax.persistence.Table(name = "ASSCTN", schema ="METADATA")
public class Association implements Serializable {

/**
 * serialVersionUID to validate serialized object
 */
@javax.persistence.Entity
@org.hibernate.annotations.FilterDef(name=“activeRecordFilter”,defaultCondition=“ACTV'N')
@org.hibernate.annotations.Filter(name=“activeRecordFilter”)
@表(name=“ASSCTN”,schema=“METADATA”)
公共类关联实现了可序列化{
/**
*用于验证序列化对象的SerialVersionId
*/
异常跟踪

org.hibernate.HibernateException: No such filter configured [activeRecordFilter]
at     org.hibernate.impl.SessionFactoryImpl.getFilterDefinition(SessionFactoryImpl.java:1204)
at org.hibernate.engine.LoadQueryInfluencers.enableFilter(LoadQueryInfluencers.java:127)
at org.hibernate.impl.SessionImpl.enableFilter(SessionImpl.java:2035)
at com.metadata.common.baseclass.GenericDAOImpl.changeSoftDeleteFilterStatus(GenericDAOImpl.java:1228)
at com.metadata.common.baseclass.GenericDAOImpl.populatePredicateList(GenericDAOImpl.java:1044)
at com.metadata.common.baseclass.GenericDAOImpl.getIFGetResponse(GenericDAOImpl.java:425)
at com.metadata.common.baseclass.GenericDAOImpl$$FastClassByCGLIB$$db8e9c53.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
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.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.metadata.common.repository.EntityRepository$$EnhancerByCGLIB$$22a81be7.getIFGetResponse(<generated>)
at com.metadata.metadatamodule.dao.GetServiceDAO.getResults(GetServiceDAO.java:51)
at com.metadata.metadatamodule.bo.GetServiceBO.getResults(GetServiceBO.java:67)
at com.metadata.metadatamodule.bo.GetServiceBO$$FastClassByCGLIB$$42f9d8cc.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
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.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.metadata.metadatamodule.bo.GetServiceBO$$EnhancerByCGLIB$$78933e6b.getResults(<generated>)
at com.metadata.metadatamodule.genericservice.GetService.getResults(GetService.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at
org.hibernate.hibernateeexception:未配置此类筛选器[activeRecordFilter]
位于org.hibernate.impl.SessionFactoryImpl.getFilterDefinition(SessionFactoryImpl.java:1204)
位于org.hibernate.engine.LoadQueryInfluders.enableFilter(LoadQueryInfluders.java:127)
位于org.hibernate.impl.SessionImpl.enableFilter(SessionImpl.java:2035)
位于com.metadata.common.baseclass.GenericDAOImpl.changeSoftDeleteFilterStatus(GenericDAOImpl.java:1228)
位于com.metadata.common.baseclass.GenericDAOImpl.populatePredicateList(GenericDAOImpl.java:1044)
位于com.metadata.common.baseclass.GenericDAOImpl.getIFGetResponse(GenericDAOImpl.java:425)
位于com.metadata.common.baseclass.GenericDAOImpl$$FastClassByCGLIB$$db8e9c53.invoke()
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
位于org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
在org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:150)上
位于org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
位于org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:172)
位于org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
在com.metadata.common.repository.EntityRepository$$enhancerbyglib$$22a81be7.getIFGetResponse()上
位于com.metadata.metadatamodule.dao.GetServiceDAO.getResults(GetServiceDAO.java:51)
位于com.metadata.metadatamodule.bo.GetServiceBO.getResults(GetServiceBO.java:67)
在com.metadata.metadatamodule.bo.GetServiceBO$$FastClassByCGLIB$$42f9d8cc.invoke()上
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
位于org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
在org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:150)上
位于org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
位于org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:172)
位于org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
在com.metadata.metadatamodule.bo.GetServiceBO$$enhancerbyglib$$78933e6b.getResults()上
位于com.metadata.metadatamodule.genericservice.GetService.getResults(GetService.java:49)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)中
位于java.lang.reflect.Method.invoke(Method.java:611)
位于com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
在

WebSphere Application Server不在共享库中搜索Java EE注释。注释将仅在EAR/WAR中物理包含的JAR文件中进行处理。

感谢您的回复。但我关心的是除了
@FilterDef
@Filter
注释之外,还有其他注释,如
@Entity
@Table
和一些为特定于项目的设置定义的自定义注释在实体jar驻留在共享库中时也可以正常工作。