Example of @Target in Hibernate
May 29, 2013
@Target forces the entity field to return specified class. By default reflection returns the object of the class as return type. Suppose a field has a return type an interface but we want to use the implementation class. In that case @Target plays a role. Find the example how to use.
@Entity @Table(name="lion") public class Lion { @Id @Column(name = "id") private int id; @Embedded @Target(AnimalImpl.class) private Animal animal; }