我在 Model 类中有一个属性,它具有 @transient 属性,我使用了此注释,因为我不希望它与数据库一起保存。但在 DaoImpl 类的查询中,我在 select 子句中使用了它。所以这给了我 :java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode
可能是什么原因?我不想删除 @transient 注释。
public class Hello implements Serializable{
@JsonIgnore
private String new;
@Transient
@JsonIgnore
private String wanted;
}
DaoImpl 类中的查询
SELECT new,wanted from Hello
最佳答案
您不能在查询中使用 transient 属性。
transient的全部含义是DB不知道这个属性
关于java - 在 Hibernate 中获取 @Transient 属性的非法状态异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33647463/