体会真正的Struts开发(4)

类别:VC语言 点击:0 评论:0 推荐:

好了,我们测试一下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>

本文地址:http://com.8s8s.com/it/it1148.htm