JPA总结.

@PersistenceContext

PersistenceAnnotationBeanPostProcessor

SharedEntityManagerInvocationHandler

@OneToOne

mappyedBy:拥有关系的字段。此元素仅在关联的反向(非拥有)端指定。

eg:

User:
id
name
@OneToOne(mappedBy="user")
Config config

Config:
key
value
@OneToOne
User user

config 表里会有个user_id的字段

@OntToMany

eg:
User:
id
name
@OneToMany(mappedBy="user")
List<Order> orders;

Order:
id:
@ManyToOne
User user;

order 表到时候会有一个user_id的外键