⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idcard.java

📁 jboss4 + Mysql +ejb3.0 EJB3 简单例子
💻 JAVA
字号:
/**
 * Copyright (c)上海烟草(集团)公司与上海康时信息系统有限公司。
 */
package com.myejb.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;


/**
 * 
 * @author xywang
 * @since 2009-2-13
 * @version 1.0
 */
@SuppressWarnings("serial")
@Entity
@Table(name="IDCard")
public class IDCard implements Serializable{
    private Integer id;
    private String cardno;
    private Person person;
    public IDCard(){}
    public IDCard(String cardno){
        this.cardno = cardno;
    }
    @Column(nullable=false,length=18,unique=true)
    public String getCardno(){
        return cardno;
    }
    public void setCardno(String cardno){
        this.cardno = cardno;
    }
    @Id
    @GeneratedValue
    public Integer getId(){
        return id;
    }
    public void setId(Integer id){
        this.id = id;
    }
    @OneToOne(optional = false,cascade = CascadeType.ALL)
    @JoinColumn(name="Person_ID",referencedColumnName ="personid", unique = true) // unique = true指明person_id列的值为能重复.
    public Person getPerson(){
        return person;
    }
    public void setPerson(Person person){
        this.person = person;
    }
    
}

⌨️ 快捷键说明

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