注册 登录
编程论坛 J2EE论坛

myecclipse6.01生成POJO的一个问题 希望高手指点!

gwj007 发布于 2008-03-14 11:14, 816 次点击
myecclipse6.01 hibernate3.1反向工程的问题
Myuser表没问题,就三个字段id,name,pass都是VARCHAR(20).
我是新装的myecclipse6.01 用hibernate3.1做反向工程生成Myuser表的pojo, 可每次他都会生成二个类MyuserId和Myuser,Myuser.hbm.xml里面内容也是
<hibernate-mapping>
    <class name="pojo.Myuser" table="myuser" catalog="gwj">
        <composite-id name="id" class="pojo.MyuserId">
            <key-property name="id" type="java.lang.String">
                <column name="id" length="20" />
            </key-property>
            <key-property name="name" type="java.lang.String">
                <column name="name" length="20" />
            </key-property>
            <key-property name="pass" type="java.lang.String">
                <column name="pass" length="20" />
            </key-property>
        </composite-id>
    </class>
</hibernate-mapping>


public class Myuser implements {

    // Fields

    private MyuserId id;

    // Constructors

    /** default constructor */
    public Myuser() {
    }

    /** full constructor */
    public Myuser(MyuserId id) {
        this.id = id;
    }

    // Property accessors

    public MyuserId getId() {
        return this.id;
    }

    public void setId(MyuserId id) {
        this.id = id;
    }

}

public class MyuserId implements {

    // Fields

    private String id;
    private String name;
    private String pass;

    // Constructors

    /** default constructor */
    public MyuserId() {
    }

    /** full constructor */
    public MyuserId(String id, String name, String pass) {
        this.id = id;
        this.name = name;
        this.pass = pass;
    }

    // Property accessors

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPass() {
        return this.pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }....


这是什么原因?请高手指点一下吧.
2 回复
#2
ynw5202008-03-14 13:15
反向的时候,你把相关的选项勾上就不会有了
#3
带头大哥2008-03-14 22:37
可能是你的表没有设主键
1