1

I have one property in Model class which is having @transient property,I have used this annotation because I don't want it to persist with database. But in the query in DaoImpl class I have used it in select clause. So this gives me :java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode

What could be the reason? I don't want to remove @transient annotation.

    public class Hello implements Serializable{
    @JsonIgnore
    private String new;

    @Transient
    @JsonIgnore
    private String wanted;

}

query in DaoImpl class

SELECT new,wanted from Hello
1
  • Transient is not saved in DB. Read documentation. Nov 11, 2015 at 10:07

3 Answers 3

4

You cannot use a transient property inside your query.

The whole meaning of transient is that DB is not aware of this property

2
  • But there is column for that property in the table. I want to fetch that column,but don't want to save any changes and updates made for that particular column in the front end to reflect in the DB. With out using that property in the query how would I get it to the front end? Nov 11, 2015 at 9:55
  • 2
    That's something you should ask as a new question. And as a hint: check @Column(insertable=false, updatable=false) before asking Nov 11, 2015 at 11:01
0

Transient means that hibernate will not even try to save it in the db, so if it is not saved then it cannot be used in queries. If you check the db you will find that there is no value entered for this field and it should not even exist as a column there. It only lives in the code.

-2

By default, all fields in your class will be persisted to the database if possible. If there is a field that should not be recorded in the database, we mark that field with the @Transient annotation. Hence data won't be saved which eventually means getting the data won't be possible

This is what I meant

1
  • That's exactly opposite to what you said. Nov 11, 2015 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.