zoukankan      html  css  js  c++  java
  • NHibernate的陷井

          这几天公司准备用NHibernate作为基础框架,上网搜了搜,NHibernate官网提供了几个版本,最基础的是NHibernate,然后NHibernate.Burrow是对前者做了一些封装,NHibernate.Burrow.AppBlock则进一步进行了封装,看了下,确实很方便,于是自己动手写点玩意。

          帮助文档都是E文版,所有又好用又不要钱的玩意好像都是外国人搞出来的,好在还不难懂。官网下了个例子,结果中了一个招。请看帮助文档:

    Now consider a model of the relationships between Customer, Order and LineItem and Product. There is a one-to-many association between Customer and Order, but how should we represent Order / LineItem / Product? I've chosen to map LineItem as an association class representing the many-to-many association between Order and Product. In NHibernate, this is called a composite element.

    Code
          请看子表名:Order
    官网的例子有个Create_SQL的建表语句,如果你按照这个例子做下去,搞一对多的测试,会发现无论如何都会报错,
    嘿嘿,想到原因没?老夫我找了好久才搞明白,浪费了大量脑细胞啊。
          NHibernate中用代码工具生成的实体类必须要将XML映射文件选成嵌入的资源,才可以正常使用。
  • 相关阅读:
    再不迁移到Material Design Components 就out啦
    Material Design Compoents 1.1.0
    Android低功耗蓝牙总结
    JAVA8 对象排序
    记录UIButton 自适应的一个坑
    MySQL 索引大全
    MySQL 与 MongoDB 的区别
    Flutter https://flutter.cn/docs学习之添加资源和图片
    Flutter https://flutter.cn/docs学习之加入交互体验
    Flutter https://flutter.cn/docs学习之向 Android 应用中添加闪屏页和启动页
  • 原文地址:https://www.cnblogs.com/millen/p/1404786.html
Copyright © 2011-2022 走看看