熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

JPA和hibernate對刪除操作的不同[3]

2022-06-13   來源: Java開源技術 

  人員的實體對象

/*
 * To change this template choose Tools | Templates
 * and open the template in the editor
 */
package comhadesleejpaentity;

import javaioSerializable;
import javaxpersistenceEntity;
import javaxpersistenceGeneratedValue;
import javaxpersistenceGenerationType;
import javaxpersistenceId;
import javaxpersistenceManyToOne;
import javaxpersistenceTable;

/**
 *
 * @author hadeslee
 */
@Entity
@Table(name = JPAPerson)
public class Person implements Serializable {

    private static final long serialVersionUID = L;
    @Id
    @GeneratedValue(strategy = GenerationTypeAUTO)
    private Integer id;
    private String name;
    private int age;
    @ManyToOne
    private Department department;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        thisage = age;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        thisdepartment = department;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        thisname = name;
    }

[]  []  []  []  []  


From:http://tw.wingwit.com/Article/program/Java/ky/201311/29046.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.