无自动ORM时父子关系的实现模式:parent.children 还是child.parentId ?

如果你的系统没有像Hibernate这样的自动ORM框架,即不会在对象Navigation时自动查数据库,那下面两种编码风格你会用哪种?

//领域概念:Order关联Customer

//风格1
public class Order {
	
	PK orderId;
	Customer customer;
 	
}

//风格2
public class Order {
	PK orderId;
	FK customerId;
}

详细内容请见附件。

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.