开发者

NHibernate and mysql timestamp

开发者 https://www.devze.com 2022-12-25 07:15 出处:网络
开发者_如何学CI am trying to do versioning with NHibernate and everything works fine, however right after the insert NHibernate tries to pull the generated timestamp by executing the following query:

开发者_如何学CI am trying to do versioning with NHibernate and everything works fine, however right after the insert NHibernate tries to pull the generated timestamp by executing the following query:

SELECT profileloc_.Updated as Updated14_ FROM profile_locale profileloc_ 
WHERE profileloc_.id=?p0 and profileloc_.culture=?p1;?p0 = 16, ?p1 = 1033

Which is totally wrong, as it will pull out all versions starting with the first one.

How do I make it add ORDER BY Updated DESC to this query? I am using Fluent NHibernate for mappings.


Turns out if I put .Generated.Never() on the timestamp property generation moves to NHibernate from MySQL and so the issue disappears. However, I prefer it to be on MySQL side if possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消