1

混淆后我得到以下异常:

org.hibernate.AnnotationException: No identifier specified for entity: com.ad.ac.c.a
    at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:268)
    at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:223)
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:686)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3977)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3931)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1368)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
    at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)
    at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:278)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:362)

我认为这是因为 Proguard 混淆了实体的 getter 和 setter 并更改了属性名称。

4

1 回答 1

7

这是 JPA 正常工作所需的我的 proguard 配置

-keepattributes RuntimeVisibleAnnotations
-keep @javax.persistence.* class * {
   *;
}

它将保持未混淆的所有持久性注释类,并且不会删除任何运行时注释。

于 2012-08-26T11:17:22.670 回答