address.java

来自「JPA入门文章源码」· Java 代码 · 共 80 行

JAVA
80
字号
package entity;

import javax.persistence.*;

/**
 * @author Antonio Goncalves
 */
@Entity
@Table(name = "t4_address")
public class Address {

    // ======================================
    // =             Attributs              =
    // ======================================
    @Id
    @GeneratedValue
    private Long id;
    private String street;
    @Column(length = 100)
    private String city;
    @Column(name = "zip_code", length = 10)
    private String zipcode;
    @Column(length = 50)
    private String country;

    // ======================================
    // =            Constructors            =
    // ======================================

    public Address() {
    }


    public Address(String street, String city, String zipcode, String country) {
        this.street = street;
        this.city = city;
        this.zipcode = zipcode;
        this.country = country;
    }

    // ======================================
    // =         Getters & Setters          =
    // ======================================

    public Long getId() {
        return id;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?