Hibernate Annotations - How do I exclude a bean´s field from mapping?

后端 未结 1 555
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-12 17:25

I´ve got a bean containing some fields, and two of them are not intended to be mapped by hibernate (errorStatus and operationResultMessage). How do I tell Hibernate (via annotat

相关标签:
1条回答
  • 2021-02-12 18:22

    Use the @Transient annotation.


    /* snip... */
    
    @Transient
    private Boolean errorStatus;
    
    @Transient
    private String operationResultMessage;
    

    Obviously, if you're annotating the getters/setters rather than the fields, that's where the @Transient annotation would go.

    0 讨论(0)
提交回复
热议问题