に関連した子のリストを表示多対1)私は2つのドメインクラス</p> <p>1を持つ親ID
package opfwflowmonitor
import java.io.Serializable;
class OpfWF_Entry implements Serializable{
String name
Date create_date
static hasOne=[siteName:OpfWF_SiteName, currentStepStatus:OpfWF_CurrentStepStatus,currentStepName:OpfWF_CurrentStepName]
static hasMany = [historySteps:OpfWF_HistoryStepsInfo]
static mapping = {
table name: "OS_WFENTRY", schema: "GSI"
version false
cache true
historySteps cache:true
sort id:"desc"
columns{
name column:'NAME'
create_date column:'CREATE_DATE'
}
}
}
そして
私はすべてのhistorystepのリストを表示するにはどうすればよいpackage opfwflowmonitor
import java.util.Date;
class OpfWF_HistoryStepsInfo {
Long entry_id
Long action_id
Long step_id
Date start_date
Date finish_date
String status
static belongsTo = [historyEntry: OpfWF_Entry]
static mapping = {
table name: "OS_HISTORYSTEP", schema: "GSI"
version false
cache true
historyEntry cache: true
sort id:"desc"
id generators: 'assigned'
columns{
id column:'ID'
action_id column:'ACTION_ID'
step_id column:'STEP_ID'
start_date column:'START_DATE'
finish_date column:'FINISH_DATE'
status column:'STATUS'
// ENTRY_ID column:'ENTRY_ID'
}
historyEntry column:'entry_id'
historyEntry insertable:false
historyEntry updateable:false
}
String toString() { "$id" }
}
私はOpfWF_Entryを選択するとすべてのプロパティ?
ユーザーがOpfWF_Entryテーブルのレコードのリストをクリックしたときに、履歴テーブルのすべてのプロパティを持つ子リストテーブルを取得する方法。
デフォルトの足場を使用していますか、独自のビューを作成していますか? –
デフォルトのスキャフォールディングは、コントローラでgrailsによって自動的に生成されます。 – element40
あなたは本当に一般的なJavaコーディング標準に従うべきです。アンダースコアは、Oracleなどの大文字と小文字を区別しないデータベースの従来の表記規則です。あなたは本当にJava/Groovyでそれらを使用しないでください...これまで。まあOKの定数は下線を持つことができますが、何でも構いません。 http://www.oracle.com/technetwork/java/codeconvtoc-136057.html – dbrin