aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate/NHibernateRegionData.cs
diff options
context:
space:
mode:
authorSean Dague2008-07-17 18:59:10 +0000
committerSean Dague2008-07-17 18:59:10 +0000
commit6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7 (patch)
tree048f753c7be960551f49c3f489b66b20371951b6 /OpenSim/Data/NHibernate/NHibernateRegionData.cs
parentgit merge (diff)
downloadopensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.zip
opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.gz
opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.bz2
opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.xz
Revert "git merge"
This reverts commit 80e1c3742a3ba7eb9aa1686a242b36f64331095a.
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateRegionData.cs')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 8ca0afe..3ba3556 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Reflection; 32using System.Reflection;
@@ -112,6 +113,33 @@ namespace OpenSim.Data.NHibernate
112 { 113 {
113 return null; 114 return null;
114 } 115 }
116
117 private void SaveOrUpdate(SceneObjectPart p)
118 {
119 try
120 {
121 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
122 criteria.Add(Expression.Eq("UUID", p.UUID));
123 if (criteria.List().Count < 1)
124 {
125 session.Save(p);
126 }
127 else if (criteria.List().Count == 1)
128 {
129 SceneObjectPart old = (SceneObjectPart)criteria.List()[0];
130 session.Evict(old);
131 session.Update(p);
132 }
133 else
134 {
135 m_log.Error("Not unique");
136 }
137 }
138 catch (Exception e)
139 {
140 m_log.Error("[NHIBERNATE] issue saving asset", e);
141 }
142 }
115 143
116 /// <summary> 144 /// <summary>
117 /// Adds an object into region storage 145 /// Adds an object into region storage
@@ -125,7 +153,7 @@ namespace OpenSim.Data.NHibernate
125 foreach (SceneObjectPart part in obj.Children.Values) 153 foreach (SceneObjectPart part in obj.Children.Values)
126 { 154 {
127 m_log.InfoFormat("Storing part {0}", part.UUID); 155 m_log.InfoFormat("Storing part {0}", part.UUID);
128 session.SaveOrUpdate(part); 156 SaveOrUpdate(part);
129 } 157 }
130 session.Flush(); 158 session.Flush();
131 } 159 }