熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

在Tomcat下配置Hibernate的開發環境[2]

2013-11-23 20:45:25  來源: Java開源技術 

     第二個文件Catjava

package hb;
public class Cat {
private String id;
private String name;
public Cat() {
}
public String getId() {
return id;
}
public void setId(String id) {
thisid = id;
}
public String getName() {
return name;
}
public void setName(String name) {
thisname = name;
}
public String toString() {
String strCat = new StringBuffer()
append(thisgetId())append( )
append(thisgetName())append( )
toString();
return strCat;
}
}

  第三個文件Cathbmxml

<?xml version= ?>
<!DOCTYPE hibernatemapping (View Source for full doctype)>
<hibernatemapping defaultcascade=none defaultaccess=property autoimport=true]
<class name=hbCat table=cat mutable=true polymorphism=implicit dynamicupdate=false dynamicinsert=false batchsize= selectbeforeupdate=false optimisticlock=version]
<id name=id type=javalangString unsavedvalue=null]
<column name=CAT_ID sqltype=varchar() notnull=true]
<generator class=uuidhex]
</id>
<property name=name notnull=false unique=false update=true insert=true]
<column name=NAME sqltype=varchar() notnull=true]
</property>
</class>
</hibernatemapping>

[]  []  []  []  


From:http://tw.wingwit.com/Article/program/Java/ky/201311/29028.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.