-3

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.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Kaushik Balasubramanain
  • 1,248
  • 6
  • 28
  • 42
  • As far as I remember JPA is just declarations of API. Which implementation do you use? – Divers Jan 05 '15 at 19:34
  • 1
    you need to do some reading on the Oracle documentation site, it is way to expansive to address here. Annotations have been around a long time and how they work or do not work is very well documented and is a huge subject. –  Jan 05 '15 at 19:41

1 Answers1

1

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.

Community
  • 1
  • 1
G Bisconcini
  • 764
  • 2
  • 6
  • 25