They look exactly the same on schema but there is difference on Hibernate Layer.
If you try something like that:
Address address = new Address();
Order order1 = new Order();
order1.setAddress(address);
Order order2 = new Order();
order2.setAddress(address);
save();
Everything will be OK. But, after save if you try get Order:
@OneToOne case:
org.hibernate.HibernateException: More than one row with the given identifier was found: 1
@ManyToOne case:
SUCCESS
Of course, your Address class should looks different in both cases.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…