From 30a77b5b9f08c5bcea3e22bfaf8641379fac0232 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 23 Jul 2008 22:14:34 +0000 Subject: implemented prim inventories for nhibernate --- OpenSim/Data/NHibernate/NHibernateRegionData.cs | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index f6c67f5..86a93f2 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs @@ -250,6 +250,16 @@ namespace OpenSim.Data.NHibernate { SOG[p.ParentUUID].AddPart(p); } + // get the inventory + + ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem)); + InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID)); + IList inventory = new List(); + foreach (TaskInventoryItem i in InvCriteria.List()) + { + inventory.Add(i); + } + p.RestoreInventoryItems(inventory); } foreach (SceneObjectGroup g in SOG.Values) { @@ -385,7 +395,26 @@ namespace OpenSim.Data.NHibernate /// public void StorePrimInventory(LLUUID primID, ICollection items) { - + ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem)); + criteria.Add(Expression.Eq("ParentPartID", primID)); + try + { + foreach (TaskInventoryItem i in criteria.List()) + { + session.Delete(i); + } + + foreach (TaskInventoryItem i in items) + { + session.Save(i); + + } + session.Flush(); + } + catch (Exception e) + { + m_log.Error("[NHIBERNATE] StoreInvetory", e); + } } } } -- cgit v1.1