Annotation | Details |
---|---|
@Id | Marks field/column as the key of the entity |
@Basic | Marks requested field to mapped as a basic type. This is applicable to primitive types and their wrappers, String , Date and Calendar . The annotation is actually optional if no parameters are given, but good style would dictate to make your intentions explicit. |
@Transient | Fields marked as transient are not considered for persistence, much like the transient keyword for serialization. |
There always needs to be a default constructor, that is, the parameterless one. In the basic example, there was no constructor specified, so Java added one; but if you add a constructor with arguments, be sure to add the parameterless constructor, too.