【发布时间】:2017-03-26 03:28:13
【问题描述】:
我的实体中有属性 DiscriminatorValue 作为瞬态,其唯一目的是稍后在我的 jsp 页面中访问,但 jsp 无法呈现它抛出 java.lang.IllegalStateException: 出现异常呈现视图,我正在使用瓷砖仅供参考。在此先感谢
@Entity
@DiscriminatorValue("YesNo")
public class Child extends Parent{ // parent entity has inheritance strategy
.....
DiscriminatorValue type; //want to access this variable in spring form
@Transient
public String getDiscriminatorValue(){
type= this.getClass().getAnnotation( DiscriminatorValue.class );
return type == null ? null : type.value();
}
}
//somewhere in jsp i have,
${child.type}
【问题讨论】:
-
这个值是多少?请向我们提供足够的信息来解决问题。
-
对不起,我的错,应该改成类型(现在编辑)
-
我试图复制您的问题我在线程“main”org.hibernate.MappingException 中收到以下异常异常:无法确定类型:javax.persistence.DiscriminatorValue,
-
这就是为什么我一直保持这种短暂性:)
标签: hibernate spring-mvc