From 4cc3aad2f9182188b2536c0345f8ae4a4b70f810 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 9 Apr 2008 16:01:57 +0000 Subject: more futzing around here. None of this works yet because bloody LLUUID isn't serializable, which is really annoying. --- OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 15 ++++++++------- OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'OpenSim') 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; using System.Collections.Generic; using libsecondlife; using NHibernate; +using NHibernate.Expression; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using NHibernate.Mapping.Attributes; @@ -298,10 +299,10 @@ namespace OpenSim.Data.NHibernate { using(ISession session = factory.OpenSession()) { try { - IQuery query = session.CreateQuery("from InventoryItems i where i.Folder = :folder"); - query.SetString("folder", folderID.ToString()); + ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); + criteria.Add(Expression.Eq("Folder", folderID) ); List list = new List(); - foreach (InventoryItemBase item in query.List()) + foreach (InventoryItemBase item in criteria.List()) { list.Add(item); } @@ -322,10 +323,10 @@ namespace OpenSim.Data.NHibernate { using(ISession session = factory.OpenSession()) { try { - IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent and i.Owner = :owner"); - query.SetParameter("parent", LLUUID.Zero, NHibernateUtil.Custom(typeof(LLUUIDUserType))); - query.SetParameter("owner", user, NHibernateUtil.Custom(typeof(LLUUIDUserType))); - foreach (InventoryFolderBase folder in query.List()) + ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); + criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) ); + criteria.Add(Expression.Eq("Owner", user) ); + foreach (InventoryFolderBase folder in criteria.List()) { return folder; } diff --git a/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs b/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs index 024d29b..9bc8016 100644 --- a/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs +++ b/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs @@ -67,7 +67,7 @@ namespace OpenSim.Data.NHibernate public Type ReturnedType { - get { return typeof(Guid); } + get { return typeof(LLUUID); } } public SqlType[] SqlTypes -- cgit v1.1