|
เยี่ยมชม ครั้ง
21,352 สมาชิก
688 VDO
3,286
บลอก
287
บทความ
222
E-Book
495
บทความ IT
44
ตัวอย่างโค้ด
631
กระทู้
|
|
|
Assosiate in Grails (อ่าน 151, คอมเมน 0)
Grails จะทำการสร้าง field ที่อ้างอิงกับ Parent ให้ถ้ากำหนดชื่อ foreign key ไม่ตรงกับในฐานข้อมูล
class Parent{
static hasMany = [childs: Child]
}
class Child{
Parent child // in database will mapping with field child_id in Parent table
}
Assosiate in Grails
class Casting {
static constraints = {
}
Movie movie
Star star
String post
String toString() {
post
}
}
class Movie {
static constraints = {
}
static hasMany=[castings:Casting]
String title
Date releaseDate
Integer runTime
String toString() {
title
}
}
class Star {
static hasMany=[castings:Casting]
String firstName
String lastName
Date birthDate
Float rating
static constraints = {
firstName()
lastName()
birthDate()
rating()
}
String toString() {
"$firstName $lastName"
}
}
เขียนเมื่อ: 2010-04-23 13:59:13
โดย: t.narika
ความเห็นจากผู้อ่าน
« previous next » บทความ คอมเมน ล่าสุด
บทความ มาใหม่
Blog ที่มีคน Commnet ล่าสุด (10 รายการ)
|
CD มาใหม่ล่าสุด
|
หนังสือของเรา : PDF File
|
การเขียนโปรแกรม JAVA เบื้องต้น
|
ใช้ Kohana ได้ใน 24 ชั่วโมง
|
CakePHP ใน 8 วัน
|
PHP E-Commerce ใน 20 ชั่วโมง
|
เส้นทางสู่โปรแกรมเมอร์
|
|
บันทึกโปรแกรมเมอร์ เล่ม 1
|
|
Blog เมื่อวาน และวันก่อน ๆ
|
บันทึกประจำวัน ของสมาชิก
|
|
|
|
|
|
|
|
|
|
|
Ubuntu Linux Programming













