需要有关 Grails 域类设计的帮助
我需要创建这样的 grails 域类(参见图片),但我不知道该怎么做。有人可以给我解决方案吗?
I need to create grails domain class like this(see image),but I don't know how to do. Can someone please give me the solution,please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
另外,如果要求您的 id 名称应该是product_id、cart_id 等,那么您必须查看文档如何做到这一点。否则,在 grails 中,默认情况下 id 字段名称仅为 id。
Also, if there is requirement that name of your id should be product_id, cart_id etc then you have to look at the documentation how to do that. Otherwise, in grails by default the id field name is id only.
这很简单。您需要为图片中的每个框创建一个域类。
这意味着:
查看 GORM 文档。
然后您可以使用脚手架创建控制器并开始玩。
It's quite simple. You need to create a domain class for each box in your picture.
That means:
Take a look on GORM documentation.
Then you can create controllers with scaffolding and start to play.
从图中可以看出,您不需要单个域类。您的图像中的每个框都需要一个。因此,您将拥有“Customer”域对象、“ProductComment”、“Product”等,并且您将通过 Grails 文档第 5 章中讨论的技术将它们关联起来。
互联网上应该有很多关于此的信息,您可以从这里开始:
http://grails.org/文档/最新/
From the picture, you don't need a single domain class. You need one for every box in your image. So you would have a 'Customer' domain object, 'ProductComment', 'Product', etc, and you would relate them via the techniques discussed in chapter 5 of the Grails documentaiton.
There should be plenty of information on the interwebs about this, you can start here:
http://grails.org/doc/latest/