Nhibernate 和 MySQL 中 BLOB 的索引前缀长度

发布于 2024-12-26 21:58:46 字数 351 浏览 1 评论 0原文

在我的数据模型中,有一个具有 byte[] Hash 属性的类,该属性被转换为 BLOB。我希望此列/属性是唯一的。

根据这个MySQL手册页面,我需要指定BLOB 的索引前缀长度,否则不允许在 BLOB 上建立索引。

CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));

在(流利的)NHibernate 中我该怎么做?

谢谢

In my data model there is a class with a byte[] Hash property, which is translated into BLOB. I want this column/property to be unique.

According to this MySQL manual page, I need to specify an index prefix length for the BLOB otherwise it doesn't allow indexing on BLOB.

CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));

In (Fluent) NHibernate how can I do it?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷弦 2025-01-02 21:58:46

hbm.xml 文件或字符串中的数据库对象和 new Configuration.Configure().Add()

http://ayende.com/blog/3947/nhibernate-mapping-database-object

database-object in a hbm.xml file or string and new Configuration.Configure().Add()

http://ayende.com/blog/3947/nhibernate-mapping-database-object

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文