像工匠一样进行重构--《Refactoring WorkBook》
将Java应用程序本地编译为EXE的几种方法
一个简单的JAVA XML解析器
Hibernate入门 - 包作用详解
RMI、CORBA、IIOP简单实例--1. RMI
使用 Configuration
Staff Info小系统开发总结
源码解读:java 解析字符串为boolean四种实现方法的细节和特点
一个电子商务网站的设计及开发环境配置文档
第五十三天补: JMS除错笔记

页面导航:
正文内容:<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="rg.superstaroa.customers.data.customers,webapplication1" table="customers">
<id name="customerid" column="customerid" type="string" length="5">
<generator class="assigned" />
</id>
<set name="orders" >
<key column="customerid" />
<one-to-many class="rg.superstaroa.orders.data.orders,webapplication1" />
</set>
<property name="companyname" column="companyname" type="string" length="40"></property>
<property name="contactname" column="contactname" type="string" length="30"></property>
<property name="contacttitle" column="contacttitle" type="string" length="30"></property>
<property name="address" column="address" type="string" length="60"></property>
<property name="city" column="city" type="string" length="15"></property>
<property name="region" column="region" type="string" length="15"></property>
<property name="postalcode" column="postalcode" type="string" length="10"></property>
<property name="country" column="country" type="string" length="15"></property>
<property name="phone" column="phone" type="string" length="24"></property>
<property name="fax" column="fax" type="string" length="24"></property>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="rg.superstaroa.orders.data.orders,webapplication1" table="orders">
<id name="orderid" column="orderid" type="int32" length="4">
<generator class="identity" />
</id>
<many-to-one name="customers" column="customerid" class="rg.superstaroa.customers.data.customers,webapplication1" />
<property name="customerid" column="customerid" type="string" length="5"></property>
<property name="employeeid" column="employeeid" type="int32" length="2"></property>
<property name="orderdate" column="orderdate" type="datetime" length="4"></property>
<property name="requireddate" column="requireddate" type="datetime" length="4"></property>
<property name="shippeddate" column="shippeddate" type="datetime" length="4"></property>
<property name="shipvia" column="shipvia" type="int32" length="4"></property>
<property name="freight" column="freight" type="decimal" length="4"></property>
<property name="shipname" column="shipname" type="string" length="40"></property>
<property name="shipaddress" column="shipaddress" type="string" length="60"></property>
<property name="shipcity" column="shipcity" type="string" length="15"></property>
<property name="shipregion" column="shipregion" type="string" length="15"></property>
<property name="shippostalcode" column="shippostalcode" type="string" length="10"></property>
<property name="shipcountry" column="shipcountry" type="string" length="15"></property>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="rg.superstarsystem.shippers.data.shippers,webapplication1" table="shippers">
<id name="shipperid" column="shipperid" type="int32" length="4">
<generator class="identity"/>
</id>
<property name="companyname" column="companyname" type="string" length="40"></property>
<property name="phone" column="phone" type="string" length="24"></property>
</class>
</hibernate-mapping>
//下面这段代码执行就完全没有问题
private void button3_click(object sender, system.eventargs e)
{
nhibernate.cfg.configuration c = new nhibernate.cfg.configuration();
c.addxmlfile(system.web.httpcontext.current.server.mappath("customers.xml"));
c.addxmlfile(system.web.httpcontext.current.server.mappath("orders.xml"));
c.addxmlfile(system.web.httpcontext.current.server.mappath("shippers.xml"));
isession vsession= c.buildsessionfactory().opensession();
itransaction vtransaction = vsession.begintransaction();
try
{
ilist data = vsession.find("from shippers");
datagrid1.datasource = data;
datagrid1.databind();
vtransaction.commit();
}
catch(exception ex)
{
vtransaction.rollback();
response.write(ex.message);
}
finally
{
vsession.close();
}
}
//这段代码去老是提示:could not execute query
private void button2_click(object sender, system.eventargs e)
{
nhibernate.cfg.configuration c = new nhibernate.cfg.configuration();
c.addxmlfile(system.web.httpcontext.current.server.mappath("customers.xml"));
c.addxmlfile(system.web.httpcontext.current.server.mappath("orders.xml"));
c.addxmlfile(system.web.httpcontext.current.server.mappath("shippers.xml"));
isession vsession= c.buildsessionfactory().opensession();
itransaction vtransaction = vsession.begintransaction();
try
{
ilist data = vsession.find("from customers");
datagrid1.datasource = data;
datagrid1.databind();
vtransaction.commit();
}
catch(exception ex)
{
vtransaction.rollback();
response.write(ex.message);
}
finally
{
vsession.close();
}
}
我测试来测试去,都是觉得是
<set name="orders" >
<key column="customerid" />
<one-to-many class="rg.superstaroa.orders.data.orders,webapplication1" />
</set>
或者,写查询语句有问题?
谁能解决,拜托~`