diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateRegionData.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index 3ba3556..38c9b9f 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs | |||
@@ -141,6 +141,34 @@ namespace OpenSim.Data.NHibernate | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | private void SaveOrUpdate(Terrain t) | ||
145 | { | ||
146 | try | ||
147 | { | ||
148 | ICriteria criteria = session.CreateCriteria(typeof(Terrain)); | ||
149 | criteria.Add(Expression.Eq("RegionID", t.RegionID)); | ||
150 | if (criteria.List().Count < 1) | ||
151 | { | ||
152 | session.Save(t); | ||
153 | } | ||
154 | else if (criteria.List().Count == 1) | ||
155 | { | ||
156 | Terrain old = (Terrain)criteria.List()[0]; | ||
157 | session.Evict(old); | ||
158 | session.Update(t); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | m_log.Error("Not unique"); | ||
163 | } | ||
164 | } | ||
165 | catch (Exception e) | ||
166 | { | ||
167 | m_log.Error("[NHIBERNATE] issue saving asset", e); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | |||
144 | /// <summary> | 172 | /// <summary> |
145 | /// Adds an object into region storage | 173 | /// Adds an object into region storage |
146 | /// </summary> | 174 | /// </summary> |