aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate/NHibernateRegionData.cs
diff options
context:
space:
mode:
authorSean Dague2008-07-16 21:27:59 +0000
committerSean Dague2008-07-16 21:27:59 +0000
commit6adac3bd5af422b80d04bac437076920b2391122 (patch)
tree2325829b27cdf51bbdff25af57811029ebfc1605 /OpenSim/Data/NHibernate/NHibernateRegionData.cs
parentmake ParentUUID be a cached value, but allow setting it for (diff)
downloadopensim-SC_OLD-6adac3bd5af422b80d04bac437076920b2391122.zip
opensim-SC_OLD-6adac3bd5af422b80d04bac437076920b2391122.tar.gz
opensim-SC_OLD-6adac3bd5af422b80d04bac437076920b2391122.tar.bz2
opensim-SC_OLD-6adac3bd5af422b80d04bac437076920b2391122.tar.xz
getting close on saving prims via nhibernate
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateRegionData.cs')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs35
1 files changed, 32 insertions, 3 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 98d82a1..1f997e7 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -34,6 +34,7 @@ using libsecondlife;
34using log4net; 34using log4net;
35using NHibernate; 35using NHibernate;
36using NHibernate.Cfg; 36using NHibernate.Cfg;
37using NHibernate.Expression;
37using NHibernate.Mapping.Attributes; 38using NHibernate.Mapping.Attributes;
38using NHibernate.Tool.hbm2ddl; 39using NHibernate.Tool.hbm2ddl;
39using OpenSim.Framework; 40using OpenSim.Framework;
@@ -123,12 +124,15 @@ namespace OpenSim.Data.NHibernate
123 { 124 {
124 try 125 try
125 { 126 {
127 m_log.InfoFormat("Storing part {0}", part.UUID);
126 session.SaveOrUpdate(part); 128 session.SaveOrUpdate(part);
129 session.Flush();
127 } 130 }
128 catch (Exception e) 131 catch (Exception e)
129 { 132 {
130 m_log.Error("Can't save: ", e); 133 m_log.Error("Can't save: ", e);
131 } 134 }
135
132 } 136 }
133 137
134 } 138 }
@@ -151,8 +155,33 @@ namespace OpenSim.Data.NHibernate
151 /// <returns>List of loaded groups</returns> 155 /// <returns>List of loaded groups</returns>
152 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) 156 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
153 { 157 {
154 List<SceneObjectGroup> prims = new List<SceneObjectGroup>(); 158 Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>();
155 return prims; 159 List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
160
161 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
162 criteria.Add(Expression.Eq("RegionID", regionUUID));
163 criteria.AddOrder( Order.Asc("ParentID") );
164 foreach (SceneObjectPart p in criteria.List())
165 {
166 // root part
167 if (p.UUID == p.ParentUUID)
168 {
169 SceneObjectGroup group = new SceneObjectGroup();
170 group.AddPart(p);
171 group.RootPart = p;
172 SOG.Add(p.ParentUUID, group);
173 }
174 else
175 {
176 SOG[p.ParentUUID].AddPart(p);
177 }
178 }
179 foreach (SceneObjectGroup g in SOG.Values)
180 {
181 ret.Add(g);
182 }
183
184 return ret;
156 } 185 }
157 186
158 /// <summary> 187 /// <summary>
@@ -215,7 +244,7 @@ namespace OpenSim.Data.NHibernate
215 /// </summary> 244 /// </summary>
216 public void Shutdown() 245 public void Shutdown()
217 { 246 {
218 247 session.Flush();
219 } 248 }
220 249
221 /// <summary> 250 /// <summary>