- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在为公司应用程序创建一个传输数据工具,用于将数据从旧版本移动到新版本,然后再返回。由于现在我们正在使用 NHibernate 和 FluentMapping,我将不得不映射所有旧表,并且有一个具有组合主键的表存在问题。该表如下所示:
public class OldTable {
public string KeyOne {get;set}
public string KeyTwo {get;set}
public string KeyN {get;set}
public int Sequence {get;set}
...
}
而且我需要将上述所有字段映射为复合键,唯一的问题是“序列”基于其他字段递增以避免重复键,其他是外键和简单字符串的混合。有没有办法做这个映射?如果需要创建表达式来计算序列,没问题。
好消息是新系统中的表只使用了一个整数Id。
最佳答案
来自documentation :
You can't use an
IIdentifierGenerator
to generate composite keys. Instead the application must assign its own identifiers.
您也可以在 HBM XML 模式中看到这一点。 <id>
允许 <generator>
待指定,但 <composite-id>
没有。
这并不是说这个特性不能添加到 NHibernate 中。如果这对您有用,请将您的功能请求提交至 the NHibernate issue tracker .如果此功能已首先在 Hibernate 中实现,则您的功能请求最有可能成功——如果是这样,将其移植过来可能很简单。听起来它可能已经在 Hibernate 中实现了: HHH-2060
关于c# - 使用 AutoInc 的 FluentMapping ComposedId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10801860/
我在任何地方都找不到这个问题的答案。使用 Delphi XE7 与 TClientDataSet、DataSnap 和 SQL Server。我需要插入一条记录,应用更新,然后刷新该记录,以便我可以获
我有一个需要 2 个字段的表。一个是外键,另一个不一定是唯一的。除了阅读“每个需要的表格都需要一个主键”之外,我真的找不到拥有主键的理由。 编辑: 这里有一些好的想法。 为了清楚起见,我将给你一个类似
我试图了解 Slick 是如何工作的以及如何使用它......并查看他们在 GitHub 中的示例我最终在 MultiDBCakeExample.scala 中得到了这个代码片段| : trait P
有人知道如何检索 ODBC INSERT 之后写入的新 AutoInc 吗?是否有一个我可以像 SQL Server 一样访问的变量?现在,我正在使用: SELECT MAX(myautoincfie
当从内存数据库更改为 Postgres 时,我遇到了 Slick 和 Postgres 的 autoInc 问题。将几个来源拼凑在一起,我最终得到了以下解决方案。这避免了在插入时向 Id 列提供 Nu
我有一个慢慢收集信息的工作表,比方说表 A1、A2、A3。 我时常需要将表 A1、A2、A3 中的新信息复制到表 B1、B2、B3 中。这些表相当大(约 20000 行)。 A1、A2、A3 表使用
我正在为公司应用程序创建一个传输数据工具,用于将数据从旧版本移动到新版本,然后再返回。由于现在我们正在使用 NHibernate 和 FluentMapping,我将不得不映射所有旧表,并且有一个具有
在表上执行 delete 后,AutoInc 的计数器不会重置回 1。这是正确的行为,对此没有异议,但我想知道是否还有什么方法可以重置 Slick AutoInc 计数器吗? 我找到的唯一方法是删除整
我正在尝试在具有 autoinc 字段的表中执行插入操作,并且我正在使用 FireDac TFDCommand 来执行此操作。那么,记录已成功插入到数据库中,但是如何获取 autoinc 字段的生成值
通过 C# 和 MySQL ADO.NET 连接器,我使用 MySqlDataAdapter 和 MySqlCommandBuilder 来更新表。 是否可以暂时强制使用 autoinc 字段?
我曾到天涯海角寻找这个问题的答案。没有太多关于 slick 2.0 的信息。下面是我的 Addresses 模型的代码,我如何让 create 方法在插入后返回 id? package models
我尝试实现以下位置提供的 akka-http Rest 示例 https://github.com/ArchDev/akka-http-rest 但我坚持了 slick.SlickExcept
我对 Slick 比较陌生,我不断收到 org.postgresql.util.PSQLException: ERROR: null value in column "id"violates not-
这是我的 table : -- Original table schema CREATE TABLE [SchoolYear] ( [Start] datetime NOT NULL,
我们使用 Delphi XE6 错误的组件是 MySQL 4.1 中的一个 TFDQuery。 当我尝试使用组打开查询时,FDQuery 显示: type mismatch expecting Aut
在下面的代码中,我可以很好地插入我的记录。但我真的很想取回插入值的 ID,以便我可以将对象作为响应的一部分返回。 def postEntry = DBAction { request => req
我是一名优秀的程序员,十分优秀!