Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderStatus应作为值对象 #3

Open
chenyyyang opened this issue May 29, 2021 · 4 comments
Open

OrderStatus应作为值对象 #3

chenyyyang opened this issue May 29, 2021 · 4 comments

Comments

@chenyyyang
Copy link

为何要把OrderStatus加上Id变成实体呢?

@banq
Copy link
Owner

banq commented May 30, 2021

OrderStatus是值对象,但是表现为数据层的实体,这是JPA技术限制。

@chenyyyang
Copy link
Author

谢谢回复,可我还是不懂“但是表现为数据层的实体,这是JPA技术限制”这句的含义。回头我再看看视频哈

@banq
Copy link
Owner

banq commented May 30, 2021

这句话意思是:数据库是需要主键的,主键是标识,而值对象则是无标识的,那么值对象保存到数据库中是不是一定不能有主键呢,不一定,在DDD中是值对象,但是在数据库中可能就是一个实体数据表,由实体数据表转为的对象称为数据层的实体对象,这个实体对象是DTO或POJO,是贫血对象,与DDD中实体不是一个概念

@chenyyyang
Copy link
Author

明白了。感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants