测试程序之前使用nhibernate 1.2 可以正常使用,将nhibernate 更换为2.1版本后,程序报错:Could not compile the NHibernateDemo.Product.hbm.xml mapping document:
弄了好几天了,总是报错,请各位大侠帮忙&……xml文件为:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernateDemo" > <class name="Product" table="Product">
<id name="Pro_id" type="String" >
<column name="Pro_id" length="10" />
<generator class="native" />
</id>
<property name="Pro_name" type="String">
<column name="Pro_name" length="20" />
</property>
<property name="Pro_price" type="float">
<column name="Pro_price" />
</property>
</class>
</hibernate-mapping>
--------------------------------------------------------------------------------------------------------
持久化类为:
using System;
using System.Collections.Generic;
using System.Text;namespace NHibernateDemo.Example
{
public class Product
{
private string pro_id;
private string pro_name;
private float pro_price;
//注NHibernate2.0需要属性为virtual public virtual string Pro_id {
get { return pro_id; }
set { pro_id = value; }
} public virtual string Pro_name
{
get { return pro_name; }
set { pro_name = value; }
} public virtual float Pro_price
{
get { return pro_price; }
set { pro_price = value; }
} }------------------------------------------------------------------------------------------------配置文件:
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the System.Data.OracleClient.dll provider for Oracle from MS -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">
User ID=hh;Password=hh;Data Source=hh
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.OracleDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
弄了好几天了,总是报错,请各位大侠帮忙&……xml文件为:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernateDemo" > <class name="Product" table="Product">
<id name="Pro_id" type="String" >
<column name="Pro_id" length="10" />
<generator class="native" />
</id>
<property name="Pro_name" type="String">
<column name="Pro_name" length="20" />
</property>
<property name="Pro_price" type="float">
<column name="Pro_price" />
</property>
</class>
</hibernate-mapping>
--------------------------------------------------------------------------------------------------------
持久化类为:
using System;
using System.Collections.Generic;
using System.Text;namespace NHibernateDemo.Example
{
public class Product
{
private string pro_id;
private string pro_name;
private float pro_price;
//注NHibernate2.0需要属性为virtual public virtual string Pro_id {
get { return pro_id; }
set { pro_id = value; }
} public virtual string Pro_name
{
get { return pro_name; }
set { pro_name = value; }
} public virtual float Pro_price
{
get { return pro_price; }
set { pro_price = value; }
} }------------------------------------------------------------------------------------------------配置文件:
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the System.Data.OracleClient.dll provider for Oracle from MS -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">
User ID=hh;Password=hh;Data Source=hh
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.OracleDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
解决方案 »
- C# 自制水晶按钮(很漂亮)
- ********* C# WF 中如何做类似内容的 ListView 项**********
- Update 无法找到 TableMapping['Table'] 或 DataTable“Table”
- 急送分!!!急寻MSF方面的资料!!!!
- 急!.net操作数据库的问题,解答立即给分
- 关于一个post 请求对应https 网站
- NPOI 【.xlsx】文件生成,报损坏错误
- 我想在asp.net中用一张表格来做一个tooltip,这个表格是动态生成的
- 怎么做个splash窗口(要让窗口停几秒)
- IIS部署网站并设置域名本地可以访问别人无法访问
- web控件 的属性编辑器为什么不管用
- 请教高手指点
看看行不行。