Tuesday, May 18, 2010

Adding additional fields in @Entity Class

In the Entity class, the persistent fields are mapped with @Column construct.But there could be some computed or other fields which are not in the table but are required in the Entity class.Adding these additional fields in the entity would give rise to Invalid Identifier Exception.To avoid this,these additional fields can be used with @Transient construct.When the fields are marked as Transient ,they are not associated with the Session Factory and their instances would be destroyed by the GC.

No comments:

Post a Comment