我想创建下面的示例 NHibernate的2.0初学者指南。这个例子是使用高住低训POID发电机映射。据我所知,这种算法需要特殊的数据库表来存储本届高值。但我不明白这是怎么表创建?我是否需要手动创建表(我还没有发现SQL脚本此表),还是应该由会话自动装箱?
I'm trying to create my first test application with NHibernate following example in NHibernate 2.0 Beginners Guide. The example is using HiLo POID generator in mappings. I understand that this algorithm requires special database table to store current Hi value. But I don't understand how is this table created? Do I need to create table manually (I haven't found SQL script for this table) or should it be crated automatically by the session?
我目前的code与消息引发异常:无效的对象名称是hibernate_unique_key和表没有在我的数据库存在
My current code is throwing exception with message: Invalid object name 'hibernate_unique_key' and table doesn't exist in my database.
我建议每桌战略希洛,要做到这一点,你需要创建表手动
和再加入一些行数据,例如中
I suggest a hilo per table strategy, to do this you will need to create the table manually
and then add some rows of data e.g.
CREATE TABLE hibernate_unique_key (
TableName varchar(25) NOT NULL,
NextHi bigint NOT NULL
)
再添加一条记录到数据库中的每
表您希望使用的希洛的:如
then add a row into the database for every
table you wish to use the hilo for: e.g.
CmsLogin,10
Address, 10
您的映射将包含以下内容: -
Your mappings would then contain the following:-
<id name="Id" column="Id" unsaved-value="0">
<generator class="hilo">
<param name="column">NextHi</param>
<param name="where">TableName='CmsLogin'</param>
<param name="max_lo">100</param>
</generator>
</id>
和中提琴!