I am new to JPA. I am using relationship annotations, such as @OneToOne, @ManyToOne.
I would like to understand how does the java compiler read annotations and interpret them.
I am new to JPA. I am using relationship annotations, such as @OneToOne, @ManyToOne.
I would like to understand how does the java compiler read annotations and interpret them.
Java Annotations and Java Reflection is what do the work of @OneToOne ; @ManyToOne behind the scenes --- and many other annotations used by JPA API Specification.
You can study and see how it works here. You can also write code that do the same "magic" like the JPA API. Also, you can read the Oracle Annotations to understand how it works.
It is important to remember that Java Persistence API is a specification. The "behind scenes" of how it works resolving the Reflection / Annotations is equal to any other vendor implementation because the Java Virtual Machine resolves that in Runtime; wich means is a mechanism of the JVM.
To understand better what it means the JPA is a specification --- wich differs from a vendor implementation ---, please, read these.