hibernate方便的操作数据库相当不错的 请各位下载看看啊
源代码在线查看: boat.java
//$Id: Boat.java,v 1.3 2004/12/08 20:05:15 epbernard Exp $ package org.hibernate.test.metadata; import javax.ejb.Entity; import javax.ejb.Id; import javax.ejb.GeneratorType; import javax.ejb.Inheritance; import javax.ejb.InheritanceType; import javax.ejb.InheritanceJoinColumn; import javax.ejb.Column; import java.io.Serializable; /** * Boat class. Mapped in a Joined manner * * @author Emmanuel Bernard */ @Entity() @Inheritance( strategy=InheritanceType.JOINED ) public class Boat implements Serializable { private Integer id; private int size; public Boat() { super(); } @Id(generate = GeneratorType.AUTO) public Integer getId() { return id; } @Column(name="boat_size") public int getSize() { return size; } public void setId(Integer integer) { id = integer; } public void setSize(int i) { size = i; } }