Interview Focused : Basic JPA Annotations to Remember

Basic JPA Annotations to remember
1)@Entity : Indicates to the JPA persistence provider that the class is an entity.
2)@Table :Indicates underlying database table that is represented by this entity class using the name attribute.
3)@Id : Indicates the primary key field in the class and is required for each entity.
4)@GeneratedValue : Indicates how the persistence engine should generate new primary key values for the insertion of records into the table.
5) @Basic : Indicates nullability of the field.
6) @Column : Specifies the column to which the field is mapped using the name attribute.
7) @NotNull & @Size are part of javax.validation.constraints package and define that the field cannot be null as well as the minimum and maximum sizes for the field.
8) @OneToMany : Indicates that this class may have a collection of an attribute.
9) @NamedQueries : Specifies multiple named Java Persistence query language queries. Query names are scoped to the persistence unit. The NamedQueries annotation can be applied to an entity or mapped superclass.


10) @NamedNativeQueries : Used to specify multiple native SQL named queries. Query names are scoped to the persistence unit. The NamedNativeQueries annotation can be applied to an entity or mapped superclass.

Comments

Popular posts from this blog

Java Interview : Threads

Spring Framework Interview Notes : Part Two Wiring

Card Dealer In Java in Less than 5 minutes