Abstract @ Basis of transition variables

I have a POJO class that consists of:
- constant properties
- transient properties.

When writing HQL, I considered how: constant and transient properties. That is, HQL as select persistent_properties,transient_prop from Pojo_classname

Is it correct?

Can I write an @Basic annotation @Basic transition variables?

+6
source share
1 answer

No, that is not right. HQL query translates to SQL. The @Transient property @Transient not in the database, so the SQL query cannot query this property.

@Basic and @Transient are conflicting. The first says that "this property is permanent," and the second says, "This property is not permanent."

If you are talking about the Java transient keyword and not the @Transient annotation, then yes, the transient field can be requested and annotated using @Basic . The transient keyword has nothing to do with persistence, only with binary serialization of an object.

+2
source

Source: https://habr.com/ru/post/902377/


All Articles