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?
Image : h开发者_运维技巧ttp://www.uppicweb.com/x/i/ib/6demo.jpg
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/
It's quite simple. You need to create a domain class for each box in your picture. That means:
- Customer
- Cart
- Product
- Product_comment
- Product_category
- Bill
- Bill_item
Take a look on GORM documentation.
Then you can create controllers with scaffolding and start to play.
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.
精彩评论