Top > SAStrutsあれこれ > JAXB2でエンティティをXMLに変換する準備しましょう
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 
 
 
 
 
 
 
 
 
-
|
|
|
|
|
|
|
==========================================
import javax.xml.bind.annotation.XmlRootElement;
 
/**
 * Addressエンティティクラスです。
 * 
 * @author S2JDBC-Gen
 */
@Entity
@XmlRootElement(name="Address")
public class Address {
 
    /** idプロパティ */
===========================================
    /** employeeList関連プロパティ */
    @OneToMany(mappedBy = "address")
    @XmlTransient
    public List<Employee> employeeList;
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 
 
 
 
 
 
 
 
 
-
|
|
|
|
|
|
|
==========================================
import javax.xml.bind.annotation.XmlRootElement;
 
/**
 * Departmentエンティティクラスです。
 * 
 * @author S2JDBC-Gen
 */
@Entity
@XmlRootElement(name="Department")
public class Department {
 
    /** idプロパティ */
=========================================
    /** employeeList関連プロパティ */
    @OneToMany(mappedBy = "department")
    @XmlTransient
    public List<Employee> employeeList;
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 
 
 
 
 
 
 
 
 
 
-
|
|
|
==========================================
import javax.xml.bind.annotation.XmlRootElement;
 
/**
 * Employeeエンティティクラスです。
 * 
 * @author S2JDBC-Gen
 */
@Entity
@XmlRootElement(name="Employee")
public class Employee {
 
    /** idプロパティ */
===========================================
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
package tutorial.entity;
 
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
 
/**
 * Addressエンティティクラスです。
 * 
 * @author S2JDBC-Gen
 */
@Entity
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="Address")
@XmlType(propOrder={"id", "name", "version", "employeeList"})
public class Address {
  
    /** idプロパティ */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(nullable = false, unique = true)
    @XmlElement(name="id")
    public Integer id;
  
    /** nameプロパティ */
    @Column(length = 255, nullable = false, unique = false)
    @XmlElement(name="name")
    public String name;
 
    /** versionプロパティ */
    @Version
    @Column(nullable = false, unique = false)
    @XmlElement(name="version")
    public Integer version;
 
    /** employeeList関連プロパティ */
    @OneToMany(mappedBy = "address")
    @XmlTransient
    public List<Employee> employeeList;
}

リロード   新規 編集 凍結解除 差分 添付 複製 名前変更   ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: 2012-08-08 (水) 23:26:03 (2923d)