diff options
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateInventoryData.cs')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 8043348..f99273a 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using NHibernate; | 33 | using NHibernate; |
34 | using NHibernate.Expression; | ||
34 | using NHibernate.Cfg; | 35 | using NHibernate.Cfg; |
35 | using NHibernate.Tool.hbm2ddl; | 36 | using NHibernate.Tool.hbm2ddl; |
36 | using NHibernate.Mapping.Attributes; | 37 | using NHibernate.Mapping.Attributes; |
@@ -298,10 +299,10 @@ namespace OpenSim.Data.NHibernate | |||
298 | { | 299 | { |
299 | using(ISession session = factory.OpenSession()) { | 300 | using(ISession session = factory.OpenSession()) { |
300 | try { | 301 | try { |
301 | IQuery query = session.CreateQuery("from InventoryItems i where i.Folder = :folder"); | 302 | ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); |
302 | query.SetString("folder", folderID.ToString()); | 303 | criteria.Add(Expression.Eq("Folder", folderID) ); |
303 | List<InventoryItemBase> list = new List<InventoryItemBase>(); | 304 | List<InventoryItemBase> list = new List<InventoryItemBase>(); |
304 | foreach (InventoryItemBase item in query.List()) | 305 | foreach (InventoryItemBase item in criteria.List()) |
305 | { | 306 | { |
306 | list.Add(item); | 307 | list.Add(item); |
307 | } | 308 | } |
@@ -322,10 +323,10 @@ namespace OpenSim.Data.NHibernate | |||
322 | { | 323 | { |
323 | using(ISession session = factory.OpenSession()) { | 324 | using(ISession session = factory.OpenSession()) { |
324 | try { | 325 | try { |
325 | IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent and i.Owner = :owner"); | 326 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); |
326 | query.SetParameter("parent", LLUUID.Zero, NHibernateUtil.Custom(typeof(LLUUIDUserType))); | 327 | criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) ); |
327 | query.SetParameter("owner", user, NHibernateUtil.Custom(typeof(LLUUIDUserType))); | 328 | criteria.Add(Expression.Eq("Owner", user) ); |
328 | foreach (InventoryFolderBase folder in query.List()) | 329 | foreach (InventoryFolderBase folder in criteria.List()) |
329 | { | 330 | { |
330 | return folder; | 331 | return folder; |
331 | } | 332 | } |