トランスフォーメーション・マッピングを作成するにはこの手順を使用します。
トランスフォーメーション・マッピングを作成するには、次のようにします。
図7-5 「トランスフォーメーション・マッピング」タブ
(DatabaseRow)
またはパラメータ(DatabaseRow, Session)
が必要です。次の項目を指定することもできます。
例7-1 トランスフォーメーション・マッピングのコード例
次のコード例は、トランスフォーメーション・マッピングに必要なメソッドを示しています。
// Get method for the normalHours attribute since method access indicated
access public Time[] getNormalHours()
{
return normalHours;
}
// Set method for the normalHours attribute since method access indicated
access public void setNormalHours(Time[] theNormalHours)
{
normalHours = theNormalHours;
}
// Create attribute transformation method to read from the database row
//** Builds the normalHours Vector. IMPORTANT: This method builds the value but does not set it. The mapping will set it using method or direct access as defined in the descriptor. */
public Time[] getNormalHoursFromRow(DatabaseRow row)
{
Time[] hours = new Time[2];
hours[0] = (Time)row.get("START_TIME");
hours[1] = (Time)row.get("END_TIME");
return hours;
}
// Define a field transformation method to write out the start time. Return the first element of the normalHours attribute.
public java.sql.Time getStartTime()
{
return getNormalHours()[0];
}
// Define a field transformation method to write out the end time. Return the last element of the normalHours attribute.
public java.sql.Time getEndTime()
{
return getNormalHours()[1];
}
Copyright © 1997, 2006, Oracle. All rights reserved.