Do I need @Transient annotation on un-mapped super-class attributes?
hibernate, java, jpa, transient
Solution
No, the `@Transient` annotation is not needed, as your `AbstractSuperEntity` is neither a `MappedSuperClass`, nor an `Entity`. You have to annotate it with one of those annotations if you want it to contain mapping information (that is inherited).
Problem
OK, here's the simple example: I have an abstract super class defined thus: ``` abstract public class AbstractSuperEntity { private char someFlag; public void setSomeFlag(char flagValue) { this.someFlag = flagValue; } public char getSomeFlag() { return this.someFlag; } } ``` which all my `@Entity` classes inherit from. An example might be: ``` @Entity @Table("SOME_ENTITY") public class SomeEntity extends AbstractSuperEntity { @Column(name="ID"); private Long id; etc. } ``` Does the `someFlag` attribute in `AbstractSuperEntity` need to have the `@Transient`? I've tried it with and without, and it doesn't seem to make any difference. But I'm just scared I'm missing something. EDIT Thanks for all the quick answers. A colleague has also pointed me to the JPA Tutorial at JPalace.org, and in particular the page on ORM and JPA Concepts which has the following section: Non-Entity Superclasses Entities may also extend non-entity superclasses. These superclasses can be either abstract or concrete. The state of non-entity superclasses is always non-persistent. Thus, any state inherited from the non-entity superclass by an entity class is non-persistent. Similarly to mapped superclasses, non-entity superclasses may not be used subject to queries. Mapping and relationship annotation present in a non-entity superclasses are ignored. Again, this is beacause there is no correponding database table to which the querying operations or relationships can be applied.