CSDN博客

img yanghx2000

体会真正的Struts开发(4)

发表于2004/3/18 12:34:00  630人阅读

好了,我们测试一下Hibernate的MySQL驱动

 

package com.test.hbm;

 

/**

 * @author yanghx

 *

 * To change the template for this generated type comment go to

 * Window - Preferences - Java - Code Generation - Code and Comments

 */

public class TestHBM {

    private String id;

    private String name;

    public String getName(){

       return name;

    }

    public void setName(String n){

       name=n;

    }

    public String getId(){

       return id;

    }

    public void setId(String i){

       id=i;

    }

}

 

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

    "-//Hibernate/Hibernate Mapping DTD//EN"

    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

    <class name="com.test.hbm.TestHBM" table="TBL_TestHBM">

       <id name="id" type="string">

           <column name="id" length="16"/>

           <generator class="assigned"/>

       </id>

       <property name="name" column="name" type="string" length="20"/>

    </class>

</hibernate-mapping>

0 0

相关博文

我的热门文章

img
取 消
img