Transient fields from Hibernate PersistentClass

105 views Asked by At

Why isnt it possible to access transient fields (or fields annotated with @Transient) with hibernates metadata API? Shouldn't PersistentClass#getProperties include all fields of the entity regardless of its annotations or field modifications (because its a metadata layer)?

1

There are 1 answers

1
Dragan Bozanovic On

A similar question would be: Why is it not possible to turn screws with a hammer? Simply, it would be unnecessary for Hibernate to store these extra information which it would never use and would never care of.

If you want dynamic access to those fields, then Hibernate mapping files are wrong place to look for them, you should probably use Java reflection.