Hibernate java.lang.IllegalStateException:在渲染视图时发生异常
我的实体中的属性DiscriminatorValue是暂时的,其唯一目的是在我的jsp页面中稍后访问,但jsp无法呈现它,抛出java.lang.IllegalStateException:Exception Occessed rendering view,我正在使用tiles供参考。提前谢谢Hibernate java.lang.IllegalStateException:在渲染视图时发生异常,hibernate,spring-mvc,Hibernate,Spring Mvc,我的实体中的属性DiscriminatorValue是暂时的,其唯一目的是在我的jsp页面中稍后访问,但jsp无法呈现它,抛出java.lang.IllegalStateException:Exception Occessed rendering view,我正在使用tiles供参考。提前谢谢 @Entity @DiscriminatorValue("YesNo") public class Child extends Parent{ // parent entity has inheritan
@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}
对类进行以下更改
@Transient
String type; //want to access this variable in spring form
public String getDiscriminatorValue(){
DiscriminatorValue type = this.getClass().getAnnotation( DiscriminatorValue.class );
return type == null ? null : type.value();
}
也可以将鉴别器作为只读属性
在父类中添加define discriminator列
@DiscriminatorColumn(name = "Dtype", discriminatorType = DiscriminatorType.STRING)
@Column(name = "Dtype", insertable = false, updatable = false)
private String type;
//类型的getter和setter这是什么val?请为我们提供足够的信息来解决问题。对不起,我的错,它应该是类型而不是(现在编辑)我试图复制您的问题我在线程“main”org.hibernate.MappingException中收到以下异常异常:无法确定类型:javax.persistence.DiscriminatorValue,这就是我保留该临时值的原因:)