When we choose the annotation-based way to provide a configuration, we don't need to create any hibernate mapping (usually
*.hbm. xml) file. Hibernate provides the annotations that we can directly write to the POJO, and we can provide all the mappings via the classes, which we can do using the previous XML file.
Now, let's create the class that contains the annotation-based mapping. As we used the
Employee class to provide XML-based mapping here, we will use the same class with annotations:
Employee.java, as shown in the following code:
import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; ...