zoukankan      html  css  js  c++  java
  • Nhibernate使用中遇到的问题

    错误信息:

    Hibernate.ByteCode.Castle.dll —> System.IO.FileLoadException: Could not load file or assembly ‘NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4′ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.

    这是Nhibernate3.2以后,nh提供了自己的proxy, 自己的bytecode,不需要引用 Hibernate.ByteCode.Castle.dll, 跟 Castle.Core.dll 了。

    新的 proxyfactory.factory_class 的设置方法:

    <property name=”proxyfactory.factory_class”>NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate</property>

    按教程配出来了hbm.xml, 写出Entity类,配好数据库的连接,Run一下,一直报

    Unable to locate persister for the entity named

    后来终于发现是hibernate.cfg.xml中未加上这一行

    <mapping assembly="nhibernateSample" />

    郁闷啊,这个是从nhibernate的目录中拷过来的啊,教程中也完全没有提到这回事。。。。

  • 相关阅读:
    I
    poj 3414 pots (bfs+路径记录)
    hdoj 1495 非常可乐(bfs)
    hdoj 1241 Oil Deposits (dfs)
    hdoj 2612 find a way (两次bfs)
    poj 3984 迷宫问题
    poj 3087 Shuffle'm Up (bfs)
    poj 3126 Prime Path (bfs)
    poj 3279 Fliptile
    hdu_3068 最长回文(Manacher算法)
  • 原文地址:https://www.cnblogs.com/Daywei/p/2848124.html
Copyright © 2011-2022 走看看