2015-10-16 43 views
0

在我们的Play应用程序中,我们使用Ebean ORM。我们有用于继承Play Model类的模型类。自Play 2.4以来,我们的模型类必须从Avaje Ebean Model类继承。这些模型类是增强的,即有几种方法被注入到我们的模型类中。由于这种变化,我们得到JAXB错误信息,说例如:Ebean增强搞乱了JAXB序列化

Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions 
com.avaje.ebean.bean.PersistenceContext is an interface, and JAXB can't handle interfaces. 
    this problem is related to the following location: 
     at com.avaje.ebean.bean.PersistenceContext 
     at public com.avaje.ebean.bean.PersistenceContext com.avaje.ebean.bean.EntityBeanIntercept.getPersistenceContext() 
     at com.avaje.ebean.bean.EntityBeanIntercept 
     at protected com.avaje.ebean.bean.EntityBeanIntercept models.Phase._ebean_intercept 
     at models.Phase 

我试图通过增加这阶段模型类来解决此问题:

@XmlTransient 
public EntityBeanIntercept _ebean_intercept() { 
    throw new NotImplementedException(); 
}; 

可惜,这招不起作用,结果在错误消息“类文件模型/阶段中的复制方法名称&签名”中。有没有另一种告诉JAXB忽略这个类的增强成员的方法?

回答