Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate java.lang.IllegalStateException:在渲染视图时发生异常_Hibernate_Spring Mvc - Fatal编程技术网

Hibernate java.lang.IllegalStateException:在渲染视图时发生异常

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

我的实体中的属性DiscriminatorValue是暂时的,其唯一目的是在我的jsp页面中稍后访问,但jsp无法呈现它,抛出java.lang.IllegalStateException:Exception Occessed rendering view,我正在使用tiles供参考。提前谢谢

@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,这就是我保留该临时值的原因:)