Delete
Do Record
Setting
Add New Item
Menu List
Title | Content Type | Order | Action | ||||||
---|---|---|---|---|---|---|---|---|---|
{{kb_content.name}} {{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
{{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
No record |
Status: published
Programming, Software and application
2020-10-14 16:12:27
Step 2: Data insert manually
1127
This is complete tutorial to build an application using grails 3.x. There are several parts of tutorial where every part has a specific objective and several steps. So it is a step by step tutorial to build a complete application using grails 3.x.
To insert a row to the contact table, your code will look like this:
def manualAdd(){ for (int i; i<5; i++){ Contact p = new Contact( firstName:'First name '+i, lastName:'Last Name '+i, email:'email'+i+'@gmail.com', city:'City '+i, country:'Country '+i, message:'message '+i ).save() } render "Added 5 data " }
Notice that the domain instance itself knows how to persist itself. In usual Java frameworks, our Pojo and DAO code are separate. But in GORM, it seems they are merged together.