Total Pageviews

2015/02/02

Generating entities from tables in Eclipse


Using this following procedure to generate Java persistent entities from database tables. 

1.  File => New => JPA Project => Click Next

2. Assign Project Name => Click Next


3. Click Next


4. Assign Platform and configure database connection => Click Finish


5. The sample JPA project, JPA_Project, had been created


6. Click src => Right Click => New => JPA Entities from Tables


7. Checked the tables which you would like to generate entities => Click Next


8. Click Next


9. Assign package name where your entities would like to place => Click Next


10. Click Finish


11. Check Result


 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package gov.nta.entity.fms;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;

/**
 * The persistent class for the FMS406FF database table.
 * 
 */
@Entity
@NamedQuery(name = "Fms406ff.findAll", query = "SELECT f FROM Fms406ff f")
public class Fms406ff implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "YYY_MM")
    private String yyyMm;

    @Column(name = "REMARKS1")
    private String remarks1;

    @Column(name = "REMARKS2")
    private String remarks2;

    @Column(name = "REMARKS3")
    private String remarks3;

    @Column(name = "UPDATE_DATE")
    private Timestamp updateDate;

    @Column(name = "USER_ID")
    private String userId;

    public Fms406ff() {
    }

    public String getYyyMm() {
        return this.yyyMm;
    }

    public void setYyyMm(String yyyMm) {
        this.yyyMm = yyyMm;
    }

    public String getRemarks1() {
        return this.remarks1;
    }

    public void setRemarks1(String remarks1) {
        this.remarks1 = remarks1;
    }

    public String getRemarks2() {
        return this.remarks2;
    }

    public void setRemarks2(String remarks2) {
        this.remarks2 = remarks2;
    }

    public String getRemarks3() {
        return this.remarks3;
    }

    public void setRemarks3(String remarks3) {
        this.remarks3 = remarks3;
    }

    public Timestamp getUpdateDate() {
        return this.updateDate;
    }

    public void setUpdateDate(Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public String getUserId() {
        return this.userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}

No comments: