@Transient not working in hibernate

烂漫一生 提交于 2019-12-01 17:16:57

Can you try creating setter and getter for the field and annotate the get method with @Transient, as follows:

private String ldapIdTemp;

 @Transient
 public String getLdapIdTemp() {
    return ldapIdTemp;
 }

 public void setLdapIdTemp(String ldapIdTemp) {
    this.ldapIdTemp = ldapIdTemp;
 }
MWiesner

Much depends on how you "integrated" this field in your Entity or class hierarchy. Moreover, field vs. property-access could cause an issue for your setting. See this post for a detailed explanation.

In your case, I could imagine that you either:

  1. mixed field and property-access in your entity inheritance strategy
  2. use XML-based configuration for Hibernate in your application.

In both cases the JPA 2.0/2.1 specification clearly states in Section 2.3.1:

It is an error if a default access type cannot be determined and an access type is not explicitly specified by means of annotations or the XML descriptor. The behavior of applications that mix the placement of annotations on fields and properties within an entity hierarchy without explicitly specifying the Access annotation is undefined.

Please check that your persistent Entity classes have either field OR property-based annotations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!