NHibernate Hi-Lo
Yo
Quick q: are Nh开发者_开发问答ibernate HiLo ids unique accross the DB?
The reason I ask is that we have multiple entities which have an image associated with them. On the client - I am simply storing these images in a folder using the enity ID as the name - am I going to trip over doing this?
w://
It sounds a bit risky to count on that the ids are unique across the database.
If you have a separate next_hi value (separate row or column in the hibernate_unique_key table) for each entity your ids will not be unique. If you all entities share the same next_hi, you will still probably get duplicate ids if you use different max_lo values for different entities.
I guess that if you use a shared next_hi value for all entities and all entities have the same max_lo, then the ids should be unique, at the cost of greater id fragmentation. But you should probably take a closer look before putting any money on it.
精彩评论