【问题标题】:Migrating Hibernate 3.6 to Hibernate 5.2.3 Fail to process type argument in a generic delcaration将 Hibernate 3.6 迁移到 Hibernate 5.2.3 无法处理泛型声明中的类型参数
【发布时间】:2016-10-10 14:02:48
【问题描述】:

首先 我正在尝试将 Hibernate 3.6 升级到 5.2.3,第一次遇到二级缓存的问题,它曾经是

configuration.setProperty(Environment.CACHE_PROVIDER,"org.hibernate.cache.HashtableCacheProvider");

由于hibernate 5没有CACH_PROVIDER,所以我改成config.setProperty(Environment.CACHE_REGION_FACTORY,"org.hibernate.cache.ehcache.EhCacheRegionFactory");

不知道这是否相关,这是堆栈跟踪:

org.hibernate.annotations.common.AssertionFailure: Fail to process type argument in a generic declaration. Member : com.rtrms.application.view.filter.CollectionFilter#filters Type: class sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
    at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl.getClassFromGenericArgument(AttributeFactory.java:877)
    at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:786)
    at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:760)
    at org.hibernate.metamodel.internal.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:541)
    at org.hibernate.metamodel.internal.AttributeFactory.buildAttribute(AttributeFactory.java:77)
    at org.hibernate.metamodel.internal.MetadataContext.wrapUp(MetadataContext.java:213)
    at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:220)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:297)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:493)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
    at com.rtrms.persistence.hibernate.HibernateRepositoryTest.buildSessionFactory(HibernateRepositoryTest.java:583)
    at com.rtrms.persistence.hibernate.HibernateRepositoryTest.setUp(HibernateRepositoryTest.java:170)
    at junit.framework.TestCase.runBare(TestCase.java:128)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:121)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

另一件事是,由于我是从休眠 3 升级到休眠 5,似乎没有一个很好的迁移过程教程,因为它做了很多更改,我是否必须从休眠 3 迁移到 4,然后4比5?或任何建议将不胜感激。谢谢。

【问题讨论】:

  • 如果您尚未解决此问题,我建议您逐步迁移。 Hibernate 4 中有很多新的变化,特别是如果您使用事件侦听器,它们的新 Integrator 机制。我们刚刚完成了这个过程,这里有更详细的描述:otter606.wordpress.com/2017/02/12/…

标签: java spring hibernate annotations


【解决方案1】:

从 5.1.2.Final 移动到 5.2.3 我收到“WildcardTypeImpl”错误,所以也许尝试移动到 5.1.2 直到 5.2 分支修复?

【讨论】:

    猜你喜欢
    • 2019-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多