aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorAdam Frisby2008-12-01 07:50:38 +0000
committerAdam Frisby2008-12-01 07:50:38 +0000
commit4ed7ca62b153817a142ded621cc5c5c1b1c055c5 (patch)
treee8cad8abe60b6becd22da1a8d2c2dfefbf6f9784 /OpenSim/Data/NHibernate
parentMantis #2729 (diff)
downloadopensim-SC_OLD-4ed7ca62b153817a142ded621cc5c5c1b1c055c5.zip
opensim-SC_OLD-4ed7ca62b153817a142ded621cc5c5c1b1c055c5.tar.gz
opensim-SC_OLD-4ed7ca62b153817a142ded621cc5c5c1b1c055c5.tar.bz2
opensim-SC_OLD-4ed7ca62b153817a142ded621cc5c5c1b1c055c5.tar.xz
* From Mantis#2701 - Implements NHibernate data adapter, adds support for MsSql2005 to NHibernate.
* Patch courtesy of Adminotech and realXtend. Thanks!
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/NHibernate/LLQuaternionUserType.cs6
-rw-r--r--OpenSim/Data/NHibernate/LLVector3UserType.cs7
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs77
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs107
-rw-r--r--OpenSim/Data/NHibernate/NHibernateManager.cs142
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs124
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs155
-rw-r--r--OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml2
-rw-r--r--OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml2
-rw-r--r--OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml10
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/002_RegionStore.sql4
-rw-r--r--OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml85
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml8
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml4
-rw-r--r--OpenSim/Data/NHibernate/Terrain.cs2
15 files changed, 350 insertions, 385 deletions
diff --git a/OpenSim/Data/NHibernate/LLQuaternionUserType.cs b/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
index 7431433..0cd5c6f 100644
--- a/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
+++ b/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
@@ -78,7 +78,11 @@ namespace OpenSim.Data.NHibernate
78 int w = rs.GetOrdinal(names[3]); 78 int w = rs.GetOrdinal(names[3]);
79 if (!rs.IsDBNull(x)) 79 if (!rs.IsDBNull(x))
80 { 80 {
81 quat = new Quaternion((Single)rs[x], (Single)rs[y], (Single)rs[z], (Single)rs[w]); 81 float X = (Single)Convert.ToDouble(rs[x].ToString());
82 float Y = (Single)Convert.ToDouble(rs[y].ToString());
83 float Z = (Single)Convert.ToDouble(rs[z].ToString());
84 float W = (Single)Convert.ToDouble(rs[w].ToString());
85 quat = new Quaternion(X, Y, Z, W);
82 } 86 }
83 return quat; 87 return quat;
84 } 88 }
diff --git a/OpenSim/Data/NHibernate/LLVector3UserType.cs b/OpenSim/Data/NHibernate/LLVector3UserType.cs
index cdd15ec..25a2bc6 100644
--- a/OpenSim/Data/NHibernate/LLVector3UserType.cs
+++ b/OpenSim/Data/NHibernate/LLVector3UserType.cs
@@ -74,9 +74,12 @@ namespace OpenSim.Data.NHibernate
74 int x = rs.GetOrdinal(names[0]); 74 int x = rs.GetOrdinal(names[0]);
75 int y = rs.GetOrdinal(names[1]); 75 int y = rs.GetOrdinal(names[1]);
76 int z = rs.GetOrdinal(names[2]); 76 int z = rs.GetOrdinal(names[2]);
77 if (!rs.IsDBNull(x)) 77 if (!rs.IsDBNull(x) && !rs.IsDBNull(y) && !rs.IsDBNull(z))
78 { 78 {
79 vector = new Vector3((Single)rs[x], (Single)rs[y], (Single)rs[z]); 79 float X = (Single)Convert.ToDouble(rs[x].ToString());
80 float Y = (Single)Convert.ToDouble(rs[y].ToString());
81 float Z = (Single)Convert.ToDouble(rs[z].ToString());
82 vector = new Vector3(X, Y, Z);
80 } 83 }
81 return vector; 84 return vector;
82 } 85 }
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 6ee527e..90d41e3 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -33,10 +33,7 @@ using System.Text.RegularExpressions;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net; 34using log4net;
35using NHibernate; 35using NHibernate;
36using NHibernate.Cfg;
37using NHibernate.Expression;
38using NHibernate.Mapping.Attributes; 36using NHibernate.Mapping.Attributes;
39using NHibernate.Tool.hbm2ddl;
40using OpenSim.Framework; 37using OpenSim.Framework;
41using Environment=NHibernate.Cfg.Environment; 38using Environment=NHibernate.Cfg.Environment;
42 39
@@ -49,9 +46,7 @@ namespace OpenSim.Data.NHibernate
49 { 46 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 48
52 private Configuration cfg; 49 private NHibernateManager manager;
53 private ISessionFactory factory;
54 private ISession session;
55 50
56 override public void Dispose() { } 51 override public void Dispose() { }
57 52
@@ -62,79 +57,23 @@ namespace OpenSim.Data.NHibernate
62 57
63 public override void Initialise(string connect) 58 public override void Initialise(string connect)
64 { 59 {
65 // Split out the dialect, driver, and connect string
66 char[] split = {';'};
67 string[] parts = connect.Split(split, 3);
68 if (parts.Length != 3)
69 {
70 // TODO: make this a real exception type
71 throw new Exception("Malformed Inventory connection string '" + connect + "'");
72 }
73
74 string dialect = parts[0];
75
76 // NHibernate setup
77 cfg = new Configuration();
78 cfg.SetProperty(Environment.ConnectionProvider,
79 "NHibernate.Connection.DriverConnectionProvider");
80 cfg.SetProperty(Environment.Dialect,
81 "NHibernate.Dialect." + dialect);
82 cfg.SetProperty(Environment.ConnectionDriver,
83 "NHibernate.Driver." + parts[1]);
84 cfg.SetProperty(Environment.ConnectionString, parts[2]);
85 cfg.AddAssembly("OpenSim.Data.NHibernate");
86
87 60
88 61 m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateAssetData");
89 HbmSerializer.Default.Validate = true; 62 manager = new NHibernateManager(connect, "AssetStore");
90 using (MemoryStream stream =
91 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
92 cfg.AddInputStream(stream);
93
94 factory = cfg.BuildSessionFactory();
95 session = factory.OpenSession();
96
97 // This actually does the roll forward assembly stuff
98 Assembly assem = GetType().Assembly;
99 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore");
100 m.Update();
101 63
102 } 64 }
103 65
104 override public AssetBase FetchAsset(UUID uuid) 66 override public AssetBase FetchAsset(UUID uuid)
105 { 67 {
106 try 68 return (AssetBase)manager.Load(typeof(AssetBase), uuid);
107 {
108 return session.Load(typeof(AssetBase), uuid) as AssetBase;
109 }
110 catch (ObjectNotFoundException)
111 {
112 m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid);
113 return null;
114 }
115 catch (Exception e)
116 {
117 m_log.Error("[NHIBERNATE] unexpected exception: ", e);
118 return null;
119 }
120 } 69 }
121 70
122 private void Save(AssetBase asset) 71 private void Save(AssetBase asset)
123 { 72 {
124 try 73 AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.FullID);
74 if (temp == null)
125 { 75 {
126 // a is not used anywhere? 76 manager.Save(asset);
127 // AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase;
128 session.Load(typeof(AssetBase), asset.FullID);
129 }
130 catch (ObjectNotFoundException)
131 {
132 session.Save(asset);
133 session.Flush();
134 }
135 catch (Exception e)
136 {
137 m_log.Error("[NHIBERNATE] issue saving asset", e);
138 } 77 }
139 } 78 }
140 79
@@ -147,7 +86,7 @@ namespace OpenSim.Data.NHibernate
147 override public void UpdateAsset(AssetBase asset) 86 override public void UpdateAsset(AssetBase asset)
148 { 87 {
149 m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); 88 m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID);
150 Save(asset); 89 manager.Update(asset);
151 } 90 }
152 91
153 // private void LogAssetLoad(AssetBase asset) 92 // private void LogAssetLoad(AssetBase asset)
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index bceb5d5..f7de8eb 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -33,10 +33,7 @@ using System.Text.RegularExpressions;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net; 34using log4net;
35using NHibernate; 35using NHibernate;
36using NHibernate.Cfg; 36using NHibernate.Criterion;
37using NHibernate.Expression;
38using NHibernate.Mapping.Attributes;
39using NHibernate.Tool.hbm2ddl;
40using OpenSim.Framework; 37using OpenSim.Framework;
41using Environment=NHibernate.Cfg.Environment; 38using Environment=NHibernate.Cfg.Environment;
42 39
@@ -46,9 +43,7 @@ namespace OpenSim.Data.NHibernate
46 { 43 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 45
49 private Configuration cfg; 46 private NHibernateManager manager;
50 private ISessionFactory factory;
51 private ISession session;
52 47
53 public void Initialise() 48 public void Initialise()
54 { 49 {
@@ -61,35 +56,8 @@ namespace OpenSim.Data.NHibernate
61 /// </summary> 56 /// </summary>
62 public void Initialise(string connect) 57 public void Initialise(string connect)
63 { 58 {
64 // Split out the dialect, driver, and connect string 59 m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateInventoryData");
65 char[] split = {';'}; 60 manager = new NHibernateManager(connect, "InventoryStore");
66 string[] parts = connect.Split(split, 3);
67 if (parts.Length != 3)
68 {
69 // TODO: make this a real exception type
70 throw new Exception("Malformed Inventory connection string '" + connect + "'");
71 }
72 string dialect = parts[0];
73
74 // Establish NHibernate Connection
75 cfg = new Configuration();
76 cfg.SetProperty(Environment.ConnectionProvider,
77 "NHibernate.Connection.DriverConnectionProvider");
78 cfg.SetProperty(Environment.Dialect,
79 "NHibernate.Dialect." + parts[0]);
80 cfg.SetProperty(Environment.ConnectionDriver,
81 "NHibernate.Driver." + parts[1]);
82 cfg.SetProperty(Environment.ConnectionString, parts[2]);
83 cfg.AddAssembly("OpenSim.Data.NHibernate");
84
85 factory = cfg.BuildSessionFactory();
86 session = factory.OpenSession();
87
88 // This actually does the roll forward assembly stuff
89 Assembly assem = GetType().Assembly;
90 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "InventoryStore");
91 m.Update();
92
93 } 61 }
94 62
95 /***************************************************************** 63 /*****************************************************************
@@ -109,7 +77,8 @@ namespace OpenSim.Data.NHibernate
109 { 77 {
110 try 78 try
111 { 79 {
112 return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase; 80 m_log.InfoFormat("[NHIBERNATE] getInventoryItem {0}", item);
81 return (InventoryItemBase)manager.Load(typeof(InventoryItemBase), item);
113 } 82 }
114 catch 83 catch
115 { 84 {
@@ -126,15 +95,11 @@ namespace OpenSim.Data.NHibernate
126 { 95 {
127 if (!ExistsItem(item.ID)) 96 if (!ExistsItem(item.ID))
128 { 97 {
129 using (ITransaction transaction = session.BeginTransaction()) 98 manager.Save(item);
130 {
131 session.Save(item);
132 transaction.Commit();
133 }
134 } 99 }
135 else 100 else
136 { 101 {
137 m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID); 102 m_log.ErrorFormat("[NHIBERNATE] Attempted to add Inventory Item {0} that already exists, updating instead", item.ID);
138 updateInventoryItem(item); 103 updateInventoryItem(item);
139 } 104 }
140 } 105 }
@@ -147,15 +112,11 @@ namespace OpenSim.Data.NHibernate
147 { 112 {
148 if (ExistsItem(item.ID)) 113 if (ExistsItem(item.ID))
149 { 114 {
150 using (ITransaction transaction = session.BeginTransaction()) 115 manager.Update(item);
151 {
152 session.Update(item);
153 transaction.Commit();
154 }
155 } 116 }
156 else 117 else
157 { 118 {
158 m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID); 119 m_log.ErrorFormat("[NHIBERNATE] Attempted to add Inventory Item {0} that already exists", item.ID);
159 } 120 }
160 } 121 }
161 122
@@ -165,11 +126,16 @@ namespace OpenSim.Data.NHibernate
165 /// <param name="item"></param> 126 /// <param name="item"></param>
166 public void deleteInventoryItem(UUID itemID) 127 public void deleteInventoryItem(UUID itemID)
167 { 128 {
168 using (ITransaction transaction = session.BeginTransaction()) 129 InventoryItemBase item = (InventoryItemBase)manager.Load(typeof(InventoryItemBase), itemID);
130 if (item != null)
169 { 131 {
170 session.Delete(itemID); 132 manager.Delete(item);
171 transaction.Commit();
172 } 133 }
134 else
135 {
136 m_log.ErrorFormat("[NHIBERNATE] Error deleting InventoryItemBase {0}", itemID);
137 }
138
173 } 139 }
174 140
175 /// <summary> 141 /// <summary>
@@ -181,11 +147,11 @@ namespace OpenSim.Data.NHibernate
181 { 147 {
182 try 148 try
183 { 149 {
184 return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase; 150 return (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folder);
185 } 151 }
186 catch 152 catch
187 { 153 {
188 m_log.ErrorFormat("Couldn't find inventory item: {0}", folder); 154 m_log.ErrorFormat("[NHIBERNATE] Couldn't find inventory item: {0}", folder);
189 return null; 155 return null;
190 } 156 }
191 } 157 }
@@ -198,15 +164,11 @@ namespace OpenSim.Data.NHibernate
198 { 164 {
199 if (!ExistsFolder(folder.ID)) 165 if (!ExistsFolder(folder.ID))
200 { 166 {
201 using (ITransaction transaction = session.BeginTransaction()) 167 manager.Save(folder);
202 {
203 session.Save(folder);
204 transaction.Commit();
205 }
206 } 168 }
207 else 169 else
208 { 170 {
209 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID); 171 m_log.ErrorFormat("[NHIBERNATE] Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID);
210 updateInventoryFolder(folder); 172 updateInventoryFolder(folder);
211 } 173 }
212 } 174 }
@@ -219,15 +181,11 @@ namespace OpenSim.Data.NHibernate
219 { 181 {
220 if (ExistsFolder(folder.ID)) 182 if (ExistsFolder(folder.ID))
221 { 183 {
222 using (ITransaction transaction = session.BeginTransaction()) 184 manager.Update(folder);
223 {
224 session.Update(folder);
225 transaction.Commit();
226 }
227 } 185 }
228 else 186 else
229 { 187 {
230 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID); 188 m_log.ErrorFormat("[NHIBERNATE] Attempted to add Inventory Folder {0} that already exists", folder.ID);
231 } 189 }
232 } 190 }
233 191
@@ -237,11 +195,16 @@ namespace OpenSim.Data.NHibernate
237 /// <param name="folder"></param> 195 /// <param name="folder"></param>
238 public void deleteInventoryFolder(UUID folderID) 196 public void deleteInventoryFolder(UUID folderID)
239 { 197 {
240 using (ITransaction transaction = session.BeginTransaction()) 198 InventoryFolderBase item = (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folderID);
199 if (item != null)
200 {
201 manager.Delete(item);
202 }
203 else
241 { 204 {
242 session.Delete(folderID.ToString()); 205 m_log.ErrorFormat("[NHIBERNATE] Error deleting InventoryFolderBase {0}", folderID);
243 transaction.Commit();
244 } 206 }
207 manager.Delete(folderID);
245 } 208 }
246 209
247 // useful private methods 210 // useful private methods
@@ -317,7 +280,7 @@ namespace OpenSim.Data.NHibernate
317 public List<InventoryItemBase> getInventoryInFolder(UUID folderID) 280 public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
318 { 281 {
319 // try { 282 // try {
320 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); 283 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(InventoryItemBase));
321 criteria.Add(Expression.Eq("Folder", folderID)); 284 criteria.Add(Expression.Eq("Folder", folderID));
322 List<InventoryItemBase> list = new List<InventoryItemBase>(); 285 List<InventoryItemBase> list = new List<InventoryItemBase>();
323 foreach (InventoryItemBase item in criteria.List()) 286 foreach (InventoryItemBase item in criteria.List())
@@ -340,7 +303,7 @@ namespace OpenSim.Data.NHibernate
340 // see InventoryItemBase.getUserRootFolder 303 // see InventoryItemBase.getUserRootFolder
341 public InventoryFolderBase getUserRootFolder(UUID user) 304 public InventoryFolderBase getUserRootFolder(UUID user)
342 { 305 {
343 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); 306 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(InventoryFolderBase));
344 criteria.Add(Expression.Eq("ParentID", UUID.Zero)); 307 criteria.Add(Expression.Eq("ParentID", UUID.Zero));
345 criteria.Add(Expression.Eq("Owner", user)); 308 criteria.Add(Expression.Eq("Owner", user));
346 foreach (InventoryFolderBase folder in criteria.List()) 309 foreach (InventoryFolderBase folder in criteria.List())
@@ -358,7 +321,7 @@ namespace OpenSim.Data.NHibernate
358 /// <param name="parentID">ID of parent</param> 321 /// <param name="parentID">ID of parent</param>
359 private void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID) 322 private void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
360 { 323 {
361 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); 324 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(InventoryFolderBase));
362 criteria.Add(Expression.Eq("ParentID", parentID)); 325 criteria.Add(Expression.Eq("ParentID", parentID));
363 foreach (InventoryFolderBase item in criteria.List()) 326 foreach (InventoryFolderBase item in criteria.List())
364 { 327 {
diff --git a/OpenSim/Data/NHibernate/NHibernateManager.cs b/OpenSim/Data/NHibernate/NHibernateManager.cs
index 161ec1d..36d84e2 100644
--- a/OpenSim/Data/NHibernate/NHibernateManager.cs
+++ b/OpenSim/Data/NHibernate/NHibernateManager.cs
@@ -25,35 +25,141 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Reflection; 29using System.Reflection;
30using System.IO;
29using log4net; 31using log4net;
30using NHibernate; 32using NHibernate;
33using NHibernate.Cfg;
34using NHibernate.Mapping.Attributes;
35using NHibernate.Tool.hbm2ddl;
36using OpenMetaverse;
37using Environment = NHibernate.Cfg.Environment;
31 38
32namespace OpenSim.Data.NHibernate 39namespace OpenSim.Data.NHibernate
33{ 40{
34 internal class NHibernateManager 41 public class NHibernateManager
35 { 42 {
36 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
37 44
38 // private ISessionFactory factory; 45 private string dialect;
39 // private ISession session; 46 private Configuration cfg;
40 // private ITransaction transaction; 47 private ISessionFactory factory;
48 private ISession session;
41 49
42 public NHibernateManager() 50 public NHibernateManager(string connect, string store)
43 { 51 {
44 // This is stubbing for now, it will become dynamic later and support different db backends 52
45// NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration(); 53 // Split out the dialect, driver, and connect string
46// cfg.Properties[NHibernate.Cfg.Environment.ConnectionProvider] = 54 char[] split = { ';' };
47// "NHibernate.Connection.DriverConnectionProvider"; 55 string[] parts = connect.Split(split, 3);
48// cfg.Properties[NHibernate.Cfg.Environment.Dialect] = 56 if (parts.Length != 3)
49// "NHibernate.Dialect.SQLite"; 57 {
50// cfg.Properties[NHibernate.Cfg.Environment.ConnectionDriver] = 58 // TODO: make this a real exception type
51// "NHibernate.Driver.SqliteClientDriver"; 59 throw new Exception("Malformed Inventory connection string '" + connect + "'");
52// cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] = 60 }
53// "URI=file:opensim-nh.db,version=3"; 61
54 62 dialect = parts[0];
55// factory = cfg.BuildSessionFactory(); 63
64 // NHibernate setup
65 cfg = new Configuration();
66 cfg.SetProperty(Environment.ConnectionProvider,
67 "NHibernate.Connection.DriverConnectionProvider");
68 cfg.SetProperty(Environment.Dialect,
69 "NHibernate.Dialect." + dialect);
70 cfg.SetProperty(Environment.ConnectionDriver,
71 "NHibernate.Driver." + parts[1]);
72 cfg.SetProperty(Environment.ConnectionString, parts[2]);
73 cfg.AddAssembly("OpenSim.Data.NHibernate");
74
75 //To create sql file uncomment code below and write the name of the file
76 //SchemaExport exp = new SchemaExport(cfg);
77 //exp.SetOutputFile("nameofthefile.sql");
78 //exp.Create(false, true);
79
80 HbmSerializer.Default.Validate = true;
81 using (MemoryStream stream =
82 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
83 cfg.AddInputStream(stream);
84
85 factory = cfg.BuildSessionFactory();
86 session = factory.OpenSession();
87
88 Assembly assem = GetType().Assembly;
89 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, store);
90 m.Update();
56 } 91 }
57 92
93 public object Load(Type type, UUID uuid)
94 {
95 object obj = null;
96 try
97 {
98 obj = session.Load(type, uuid);
99 }
100 catch (Exception)
101 {
102 m_log.ErrorFormat("[NHIBERNATE] {0} not found with ID {1} ", type.Name, uuid);
103 }
104 return obj;
105
106 }
107
108 public bool Save(object obj)
109 {
110 try
111 {
112 session.BeginTransaction();
113 session.Save(obj);
114 session.Transaction.Commit();
115 session.Flush();
116 return true;
117 }
118 catch (Exception e)
119 {
120 m_log.Error("[NHIBERNATE] issue saving object ", e);
121 }
122 return false;
123 }
124
125 public bool Update(object obj)
126 {
127 try
128 {
129 session.BeginTransaction();
130 session.Update(obj);
131 session.Transaction.Commit();
132 session.Flush();
133 return true;
134 }
135 catch (Exception e)
136 {
137 m_log.Error("[NHIBERNATE] issue updating object ", e);
138 }
139 return false;
140 }
141
142 public bool Delete(object obj)
143 {
144 try
145 {
146 session.BeginTransaction();
147 session.Delete(obj);
148 session.Transaction.Commit();
149 session.Flush();
150 return true;
151 }
152 catch (Exception e)
153 {
154
155 m_log.Error("[NHIBERNATE] issue deleting object ", e);
156 }
157 return false;
158 }
159
160 public ISession GetSession()
161 {
162 return session;
163 }
58 } 164 }
59} 165}
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 475cd71..0aba58c 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -34,10 +34,7 @@ using System.Text.RegularExpressions;
34using OpenMetaverse; 34using OpenMetaverse;
35using log4net; 35using log4net;
36using NHibernate; 36using NHibernate;
37using NHibernate.Cfg; 37using NHibernate.Criterion;
38using NHibernate.Expression;
39using NHibernate.Mapping.Attributes;
40using NHibernate.Tool.hbm2ddl;
41using OpenSim.Framework; 38using OpenSim.Framework;
42using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
43using OpenSim.Region.Environment.Scenes; 40using OpenSim.Region.Environment.Scenes;
@@ -52,51 +49,12 @@ namespace OpenSim.Data.NHibernate
52 { 49 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 51
55 private Configuration cfg; 52 private NHibernateManager manager;
56 private ISessionFactory factory;
57 private ISession session;
58
59 // public void Initialise()
60 // {
61 // Initialise("SQLiteDialect;SqliteClientDriver;URI=file:OpenSim.db,version=3", true);
62 // }
63 53
64 public void Initialise(string connect) 54 public void Initialise(string connect)
65 { 55 {
66 // Split out the dialect, driver, and connect string 56 m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateRegionData");
67 char[] split = {';'}; 57 manager = new NHibernateManager(connect, "RegionStore");
68 string[] parts = connect.Split(split, 3);
69 if (parts.Length != 3)
70 {
71 // TODO: make this a real exception type
72 throw new Exception("Malformed Region connection string '" + connect + "'");
73 }
74
75 string dialect = parts[0];
76
77 // NHibernate setup
78 cfg = new Configuration();
79 cfg.SetProperty(Environment.ConnectionProvider,
80 "NHibernate.Connection.DriverConnectionProvider");
81 cfg.SetProperty(Environment.Dialect,
82 "NHibernate.Dialect." + dialect);
83 cfg.SetProperty(Environment.ConnectionDriver,
84 "NHibernate.Driver." + parts[1]);
85 cfg.SetProperty(Environment.ConnectionString, parts[2]);
86 cfg.AddAssembly("OpenSim.Data.NHibernate");
87
88 HbmSerializer.Default.Validate = true;
89 using (MemoryStream stream =
90 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
91 cfg.AddInputStream(stream);
92
93 factory = cfg.BuildSessionFactory();
94 session = factory.OpenSession();
95
96 // This actually does the roll forward assembly stuff
97 Assembly assem = GetType().Assembly;
98 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore");
99 m.Update();
100 } 58 }
101 59
102 /*********************************************************************** 60 /***********************************************************************
@@ -122,15 +80,18 @@ namespace OpenSim.Data.NHibernate
122 { 80 {
123 try 81 try
124 { 82 {
125 SceneObjectPart old = session.Load(typeof(SceneObjectPart), p.UUID) as SceneObjectPart; 83 SceneObjectPart old = (SceneObjectPart)manager.Load(typeof(SceneObjectPart), p.UUID);
126 session.Evict(old); 84 if (old != null)
127 session.Update(p); 85 {
128 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID); 86 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
129 } 87 manager.Update(old);
130 catch (ObjectNotFoundException) 88 }
131 { 89 else
132 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID); 90 {
133 session.Save(p); 91 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID);
92 manager.Save(p);
93 }
94
134 } 95 }
135 catch (Exception e) 96 catch (Exception e)
136 { 97 {
@@ -142,15 +103,19 @@ namespace OpenSim.Data.NHibernate
142 { 103 {
143 try 104 try
144 { 105 {
145 Terrain old = session.Load(typeof(Terrain), t.RegionID) as Terrain; 106
146 session.Evict(old); 107 Terrain old = (Terrain)manager.Load(typeof(Terrain), t.RegionID);
147 session.Update(t); 108 if (old != null)
148 session.Flush(); 109 {
149 } 110 m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID);
150 catch (ObjectNotFoundException) 111 manager.Update(old);
151 { 112 }
152 session.Save(t); 113 else
153 session.Flush(); 114 {
115 m_log.InfoFormat("[NHIBERNATE] saving terrain {0}", t.RegionID);
116 manager.Save(t);
117 }
118
154 } 119 }
155 catch (Exception e) 120 catch (Exception e)
156 { 121 {
@@ -173,7 +138,6 @@ namespace OpenSim.Data.NHibernate
173 m_log.InfoFormat("Storing part {0}", part.UUID); 138 m_log.InfoFormat("Storing part {0}", part.UUID);
174 SaveOrUpdate(part); 139 SaveOrUpdate(part);
175 } 140 }
176 session.Flush();
177 } 141 }
178 catch (Exception e) 142 catch (Exception e)
179 { 143 {
@@ -185,7 +149,7 @@ namespace OpenSim.Data.NHibernate
185 { 149 {
186 SceneObjectGroup group = new SceneObjectGroup(); 150 SceneObjectGroup group = new SceneObjectGroup();
187 151
188 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart)); 152 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
189 criteria.Add(Expression.Eq("RegionID", region)); 153 criteria.Add(Expression.Eq("RegionID", region));
190 criteria.Add(Expression.Eq("ParentUUID", uuid)); 154 criteria.Add(Expression.Eq("ParentUUID", uuid));
191 criteria.AddOrder( Order.Asc("ParentID") ); 155 criteria.AddOrder( Order.Asc("ParentID") );
@@ -216,9 +180,8 @@ namespace OpenSim.Data.NHibernate
216 SceneObjectGroup g = LoadObject(obj, regionUUID); 180 SceneObjectGroup g = LoadObject(obj, regionUUID);
217 foreach (SceneObjectPart p in g.Children.Values) 181 foreach (SceneObjectPart p in g.Children.Values)
218 { 182 {
219 session.Delete(p); 183 manager.Delete(p);
220 } 184 }
221 session.Flush();
222 185
223 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); 186 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
224 187
@@ -234,7 +197,7 @@ namespace OpenSim.Data.NHibernate
234 Dictionary<UUID, SceneObjectGroup> SOG = new Dictionary<UUID, SceneObjectGroup>(); 197 Dictionary<UUID, SceneObjectGroup> SOG = new Dictionary<UUID, SceneObjectGroup>();
235 List<SceneObjectGroup> ret = new List<SceneObjectGroup>(); 198 List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
236 199
237 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart)); 200 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
238 criteria.Add(Expression.Eq("RegionID", regionUUID)); 201 criteria.Add(Expression.Eq("RegionID", regionUUID));
239 criteria.AddOrder( Order.Asc("ParentID") ); 202 criteria.AddOrder( Order.Asc("ParentID") );
240 foreach (SceneObjectPart p in criteria.List()) 203 foreach (SceneObjectPart p in criteria.List())
@@ -252,7 +215,7 @@ namespace OpenSim.Data.NHibernate
252 } 215 }
253 // get the inventory 216 // get the inventory
254 217
255 ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem)); 218 ICriteria InvCriteria = manager.GetSession().CreateCriteria(typeof(TaskInventoryItem));
256 InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID)); 219 InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID));
257 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 220 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
258 foreach (TaskInventoryItem i in InvCriteria.List()) 221 foreach (TaskInventoryItem i in InvCriteria.List())
@@ -291,16 +254,14 @@ namespace OpenSim.Data.NHibernate
291 /// <returns>Heightfield data</returns> 254 /// <returns>Heightfield data</returns>
292 public double[,] LoadTerrain(UUID regionID) 255 public double[,] LoadTerrain(UUID regionID)
293 { 256 {
294 try 257 Terrain t = (Terrain)manager.Load(typeof(Terrain), regionID);
258 if (t != null)
295 { 259 {
296 Terrain t = session.Load(typeof(Terrain), regionID) as Terrain;
297 return t.Doubles; 260 return t.Doubles;
298 } 261 }
299 catch (ObjectNotFoundException) 262
300 { 263 m_log.Info("No terrain yet");
301 m_log.Info("No terrain yet"); 264 return null;
302 return null;
303 }
304 } 265 }
305 266
306 /// <summary> 267 /// <summary>
@@ -339,7 +300,7 @@ namespace OpenSim.Data.NHibernate
339 /// </summary> 300 /// </summary>
340 public void Shutdown() 301 public void Shutdown()
341 { 302 {
342 session.Flush(); 303 //session.Flush();
343 } 304 }
344 305
345 /// <summary> 306 /// <summary>
@@ -397,21 +358,20 @@ namespace OpenSim.Data.NHibernate
397 /// <param name="items"></param> 358 /// <param name="items"></param>
398 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 359 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
399 { 360 {
400 ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem)); 361 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(TaskInventoryItem));
401 criteria.Add(Expression.Eq("ParentPartID", primID)); 362 criteria.Add(Expression.Eq("ParentPartID", primID));
402 try 363 try
403 { 364 {
404 foreach (TaskInventoryItem i in criteria.List()) 365 foreach (TaskInventoryItem i in criteria.List())
405 { 366 {
406 session.Delete(i); 367 manager.Delete(i);
407 } 368 }
408 369
409 foreach (TaskInventoryItem i in items) 370 foreach (TaskInventoryItem i in items)
410 { 371 {
411 session.Save(i); 372 manager.Save(i);
412 373
413 } 374 }
414 session.Flush();
415 } 375 }
416 catch (Exception e) 376 catch (Exception e)
417 { 377 {
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 3a22dc3..ee0d2b8 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -33,10 +33,7 @@ using System.Text.RegularExpressions;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net; 34using log4net;
35using NHibernate; 35using NHibernate;
36using NHibernate.Cfg; 36using NHibernate.Criterion;
37using NHibernate.Expression;
38using NHibernate.Mapping.Attributes;
39using NHibernate.Tool.hbm2ddl;
40using OpenSim.Framework; 37using OpenSim.Framework;
41using Environment=NHibernate.Cfg.Environment; 38using Environment=NHibernate.Cfg.Environment;
42 39
@@ -49,9 +46,7 @@ namespace OpenSim.Data.NHibernate
49 { 46 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 48
52 private Configuration cfg; 49 private NHibernateManager manager;
53 private ISessionFactory factory;
54 private ISession session;
55 50
56 public override void Initialise() 51 public override void Initialise()
57 { 52 {
@@ -61,62 +56,40 @@ namespace OpenSim.Data.NHibernate
61 56
62 public override void Initialise(string connect) 57 public override void Initialise(string connect)
63 { 58 {
64 char[] split = {';'}; 59 m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateUserData");
65 string[] parts = connect.Split(split, 3); 60 manager = new NHibernateManager(connect, "UserStore");
66 if (parts.Length != 3)
67 {
68 // TODO: make this a real exception type
69 throw new Exception("Malformed Inventory connection string '" + connect + "'");
70 }
71 string dialect = parts[0];
72
73 // This is stubbing for now, it will become dynamic later and support different db backends
74 cfg = new Configuration();
75 cfg.SetProperty(Environment.ConnectionProvider,
76 "NHibernate.Connection.DriverConnectionProvider");
77 cfg.SetProperty(Environment.Dialect,
78 "NHibernate.Dialect." + parts[0]);
79 cfg.SetProperty(Environment.ConnectionDriver,
80 "NHibernate.Driver." + parts[1]);
81 cfg.SetProperty(Environment.ConnectionString, parts[2]);
82 cfg.AddAssembly("OpenSim.Data.NHibernate");
83
84 factory = cfg.BuildSessionFactory();
85 session = factory.OpenSession();
86
87 // This actually does the roll forward assembly stuff
88 Assembly assem = GetType().Assembly;
89 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore");
90 m.Update();
91 } 61 }
92 62
93 private bool ExistsUser(UUID uuid) 63 private bool ExistsUser(UUID uuid)
94 { 64 {
95 UserProfileData user = null; 65 UserProfileData user = null;
96 try 66
97 { 67 m_log.InfoFormat("[NHIBERNATE] ExistsUser; {0}", uuid);
98 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; 68 user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid);
99 } 69
100 catch (ObjectNotFoundException) 70 if (user == null)
101 { 71 {
102 user = null; 72 m_log.InfoFormat("[NHIBERNATE] User with given UUID does not exist {0} ", uuid);
73 return false;
103 } 74 }
104 75
105 return (user != null); 76 return true;
77
106 } 78 }
107 79
108 override public UserProfileData GetUserByUUID(UUID uuid) 80 override public UserProfileData GetUserByUUID(UUID uuid)
109 { 81 {
110 UserProfileData user; 82 UserProfileData user;
111 // TODO: I'm sure I'll have to do something silly here 83 m_log.InfoFormat("[NHIBERNATE] GetUserByUUID: {0} ", uuid);
112 try 84
85 user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid);
86 if (user != null)
113 { 87 {
114 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; 88 UserAgentData agent = GetAgentByUUID(uuid);
115 user.CurrentAgent = GetAgentByUUID(uuid); 89 if (agent != null)
116 } 90 {
117 catch (ObjectNotFoundException) 91 user.CurrentAgent = agent;
118 { 92 }
119 user = null;
120 } 93 }
121 94
122 return user; 95 return user;
@@ -126,33 +99,30 @@ namespace OpenSim.Data.NHibernate
126 { 99 {
127 if (!ExistsUser(profile.ID)) 100 if (!ExistsUser(profile.ID))
128 { 101 {
129 session.Save(profile); 102 m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID);
103 manager.Save(profile);
130 SetAgentData(profile.ID, profile.CurrentAgent); 104 SetAgentData(profile.ID, profile.CurrentAgent);
105
131 } 106 }
132 else 107 else
133 { 108 {
134 m_log.ErrorFormat("Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName); 109 m_log.ErrorFormat("[NHIBERNATE] Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName);
135 UpdateUserProfile(profile); 110 UpdateUserProfile(profile);
136 } 111 }
137 } 112 }
138 113
139 private void SetAgentData(UUID uuid, UserAgentData agent) 114 private void SetAgentData(UUID uuid, UserAgentData agent)
140 { 115 {
141 if (agent == null) 116 UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), uuid);
117 if (old != null)
142 { 118 {
143 // TODO: got to figure out how to do a delete right 119 m_log.InfoFormat("[NHIBERNATE] SetAgentData deleting old: {0} ",uuid);
120 manager.Delete(old);
144 } 121 }
145 else 122 if (agent != null)
146 { 123 {
147 try 124 m_log.InfoFormat("[NHIBERNATE] SetAgentData: {0} ", agent.ProfileID);
148 { 125 manager.Save(agent);
149 UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData;
150 session.Delete(old);
151 }
152 catch (ObjectNotFoundException)
153 {
154 }
155 session.Save(agent);
156 } 126 }
157 127
158 } 128 }
@@ -160,13 +130,13 @@ namespace OpenSim.Data.NHibernate
160 { 130 {
161 if (ExistsUser(profile.ID)) 131 if (ExistsUser(profile.ID))
162 { 132 {
163 session.Update(profile); 133 manager.Update(profile);
164 SetAgentData(profile.ID, profile.CurrentAgent); 134 SetAgentData(profile.ID, profile.CurrentAgent);
165 return true; 135 return true;
166 } 136 }
167 else 137 else
168 { 138 {
169 m_log.ErrorFormat("Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName); 139 m_log.ErrorFormat("[NHIBERNATE] Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName);
170 AddNewUserProfile(profile); 140 AddNewUserProfile(profile);
171 return true; 141 return true;
172 } 142 }
@@ -174,37 +144,32 @@ namespace OpenSim.Data.NHibernate
174 144
175 override public void AddNewUserAgent(UserAgentData agent) 145 override public void AddNewUserAgent(UserAgentData agent)
176 { 146 {
177 try 147 UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), agent.ProfileID);
148 if (old != null)
178 { 149 {
179 UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData; 150 manager.Delete(old);
180 session.Delete(old);
181 } 151 }
182 catch (ObjectNotFoundException) 152
183 { 153 manager.Save(agent);
184 } 154
185 session.Save(agent);
186 } 155 }
187 156
188 public void UpdateUserAgent(UserAgentData agent) 157 public void UpdateUserAgent(UserAgentData agent)
189 { 158 {
190 session.Update(agent); 159 m_log.InfoFormat("[NHIBERNATE] UpdateUserAgent: {0} ", agent.ProfileID);
160 manager.Update(agent);
191 } 161 }
192 162
193 override public UserAgentData GetAgentByUUID(UUID uuid) 163 override public UserAgentData GetAgentByUUID(UUID uuid)
194 { 164 {
195 try 165 m_log.InfoFormat("[NHIBERNATE] GetAgentByUUID: {0} ", uuid);
196 { 166 return (UserAgentData)manager.Load(typeof(UserAgentData), uuid);
197 return session.Load(typeof(UserAgentData), uuid) as UserAgentData;
198 }
199 catch
200 {
201 return null;
202 }
203 } 167 }
204 168
205 override public UserProfileData GetUserByName(string fname, string lname) 169 override public UserProfileData GetUserByName(string fname, string lname)
206 { 170 {
207 ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); 171 m_log.InfoFormat("[NHIBERNATE] GetUserByName: {0} {1} ", fname, lname);
172 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(UserProfileData));
208 criteria.Add(Expression.Eq("FirstName", fname)); 173 criteria.Add(Expression.Eq("FirstName", fname));
209 criteria.Add(Expression.Eq("SurName", lname)); 174 criteria.Add(Expression.Eq("SurName", lname));
210 foreach (UserProfileData profile in criteria.List()) 175 foreach (UserProfileData profile in criteria.List())
@@ -233,7 +198,7 @@ namespace OpenSim.Data.NHibernate
233 198
234 if (querysplit.Length == 2) 199 if (querysplit.Length == 2)
235 { 200 {
236 ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); 201 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(UserProfileData));
237 criteria.Add(Expression.Like("FirstName", querysplit[0])); 202 criteria.Add(Expression.Like("FirstName", querysplit[0]));
238 criteria.Add(Expression.Like("SurName", querysplit[1])); 203 criteria.Add(Expression.Like("SurName", querysplit[1]));
239 foreach (UserProfileData profile in criteria.List()) 204 foreach (UserProfileData profile in criteria.List())
@@ -262,26 +227,18 @@ namespace OpenSim.Data.NHibernate
262 /// TODO: stubs for now to get us to a compiling state gently 227 /// TODO: stubs for now to get us to a compiling state gently
263 public override AvatarAppearance GetUserAppearance(UUID user) 228 public override AvatarAppearance GetUserAppearance(UUID user)
264 { 229 {
265 AvatarAppearance appearance; 230 return (AvatarAppearance)manager.Load(typeof(AvatarAppearance), user);
266 // TODO: I'm sure I'll have to do something silly here
267 try {
268 appearance = session.Load(typeof(AvatarAppearance), user) as AvatarAppearance;
269 } catch (ObjectNotFoundException) {
270 appearance = null;
271 }
272 return appearance;
273 } 231 }
274 232
275 private bool ExistsAppearance(UUID uuid) 233 private bool ExistsAppearance(UUID uuid)
276 { 234 {
277 AvatarAppearance appearance; 235 AvatarAppearance appearance = (AvatarAppearance)manager.Load(typeof(AvatarAppearance), uuid);
278 try { 236 if (appearance == null)
279 appearance = session.Load(typeof(AvatarAppearance), uuid) as AvatarAppearance; 237 {
280 } catch (ObjectNotFoundException) { 238 return false;
281 appearance = null;
282 } 239 }
283 240
284 return (appearance == null) ? false : true; 241 return true;
285 } 242 }
286 243
287 244
@@ -295,11 +252,11 @@ namespace OpenSim.Data.NHibernate
295 bool exists = ExistsAppearance(user); 252 bool exists = ExistsAppearance(user);
296 if (exists) 253 if (exists)
297 { 254 {
298 session.Update(appearance); 255 manager.Update(appearance);
299 } 256 }
300 else 257 else
301 { 258 {
302 session.Save(appearance); 259 manager.Save(appearance);
303 } 260 }
304 } 261 }
305 262
diff --git a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml
index 7c3d8cf..7c42609 100644
--- a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml
@@ -4,7 +4,7 @@
4 <id name="FullID" column="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 4 <id name="FullID" column="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7 <property name="Type" type="System.SByte" /> 7 <property name="Type" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
8 <property name="Name" type="String" length="64" /> 8 <property name="Name" type="String" length="64" />
9 <property name="Description" type="String" length="64" /> 9 <property name="Description" type="String" length="64" />
10 <property name="Local" type="boolean" /> 10 <property name="Local" type="boolean" />
diff --git a/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml
index 6afe9fa..c5f0115 100644
--- a/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml
@@ -5,7 +5,7 @@
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7 <property name="Type" type="Int16" /> 7 <property name="Type" type="Int16" />
8 <property name="Version" type="System.UInt16" /> 8 <property name="Version" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
9 <property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 9 <property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
10 <property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 10 <property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
11 <property name="Name" type="String" length="64" /> 11 <property name="Name" type="String" length="64" />
diff --git a/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml
index 9a4d7ca..f5e365b 100644
--- a/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml
@@ -12,15 +12,15 @@
12 <property name="Creator" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 12 <property name="Creator" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
13 <property name="Name" type="String" length="64" /> 13 <property name="Name" type="String" length="64" />
14 <property name="Description" type="String" length="64" /> 14 <property name="Description" type="String" length="64" />
15 <property name="NextPermissions" type="System.UInt32" /> 15 <property name="NextPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
16 <property name="CurrentPermissions" type="System.UInt32" /> 16 <property name="CurrentPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
17 <property name="BasePermissions" type="System.UInt32" /> 17 <property name="BasePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
18 <property name="EveryOnePermissions" type="System.UInt32" /> 18 <property name="EveryOnePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
19 <property name="GroupID" index="item_group_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 19 <property name="GroupID" index="item_group_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
20 <property name="GroupOwned" type="boolean" /> 20 <property name="GroupOwned" type="boolean" />
21 <property name="SalePrice" type="System.Int32" /> 21 <property name="SalePrice" type="System.Int32" />
22 <property name="SaleType" type="System.Byte" /> 22 <property name="SaleType" type="System.Byte" />
23 <property name="Flags" type="System.UInt32" /> 23 <property name="Flags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
24 <property name="CreationDate" type="System.Int32" /> 24 <property name="CreationDate" type="System.Int32" />
25 </class> 25 </class>
26</hibernate-mapping> 26</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/002_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/002_RegionStore.sql
index fc11e95..d34d44e 100644
--- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/002_RegionStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/002_RegionStore.sql
@@ -2,8 +2,8 @@ BEGIN;
2 2
3CREATE TABLE `Terrain` ( 3CREATE TABLE `Terrain` (
4 `RegionID` char(36) not null, 4 `RegionID` char(36) not null,
5 `Map` longblob, 5 `MapData` longblob,
6 PRIMARY KEY (`RegionID`) 6 PRIMARY KEY (`RegionID`)
7) ENGINE=InnoDB DEFAULT CHARSET=utf8; 7) ENGINE=InnoDB DEFAULT CHARSET=utf8;
8 8
9COMMIT; \ No newline at end of file 9COMMIT;
diff --git a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
index fe055bb..1851904 100644
--- a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
@@ -4,7 +4,7 @@
4 <id name="UUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 4 <id name="UUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7 <property name="ParentID" type="System.UInt32"/> 7 <property name="ParentID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate"/>
8 <property name="ParentUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 8 <property name="ParentUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
9 <property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 9 <property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
10 <property name="CreationDate" type="System.Int32" /> 10 <property name="CreationDate" type="System.Int32" />
@@ -14,17 +14,17 @@
14 <property name="SitName" type="String" length="255" /> 14 <property name="SitName" type="String" length="255" />
15 <property name="TouchName" type="String" length="255" /> 15 <property name="TouchName" type="String" length="255" />
16 16
17 <property name="ObjectFlags" type="System.UInt32" /> 17 <property name="ObjectFlags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
18 <property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 18 <property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
19 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 19 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
20 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 20 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
21 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 21 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
22 22
23 <property name="OwnerMask" type="System.UInt32" /> 23 <property name="OwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
24 <property name="NextOwnerMask" type="System.UInt32" /> 24 <property name="NextOwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
25 <property name="GroupMask" type="System.UInt32" /> 25 <property name="GroupMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
26 <property name="EveryoneMask" type="System.UInt32" /> 26 <property name="EveryoneMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
27 <property name="BaseMask" type="System.UInt32" /> 27 <property name="BaseMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
28 28
29 <property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" > 29 <property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
30 <column name="PositionX" /> 30 <column name="PositionX" />
@@ -83,24 +83,24 @@
83 <column name="ScaleZ" /> 83 <column name="ScaleZ" />
84 </property> 84 </property>
85 <property name="PCode" type="System.Byte" /> 85 <property name="PCode" type="System.Byte" />
86 <property name="PathBegin" type="System.UInt16" /> 86 <property name="PathBegin" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
87 <property name="PathEnd" type="System.UInt16" /> 87 <property name="PathEnd" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
88 <property name="PathScaleX" type="System.Byte" /> 88 <property name="PathScaleX" type="System.Byte" />
89 <property name="PathScaleY" type="System.Byte" /> 89 <property name="PathScaleY" type="System.Byte" />
90 <property name="PathShearX" type="System.Byte" /> 90 <property name="PathShearX" type="System.Byte" />
91 <property name="PathShearY" type="System.Byte" /> 91 <property name="PathShearY" type="System.Byte" />
92 <property name="PathSkew" type="System.SByte" /> 92 <property name="PathSkew" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
93 <property name="PathCurve" type="System.Byte" /> 93 <property name="PathCurve" type="System.Byte" />
94 <property name="PathRadiusOffset" type="System.SByte" /> 94 <property name="PathRadiusOffset" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
95 <property name="PathRevolutions" type="System.Byte" /> 95 <property name="PathRevolutions" type="System.Byte" />
96 <property name="PathTaperX" type="System.SByte" /> 96 <property name="PathTaperX" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
97 <property name="PathTwist" type="System.SByte" /> 97 <property name="PathTwist" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
98 <property name="ProfileBegin" type="System.UInt16" /> 98 <property name="ProfileBegin" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
99 <property name="ProfileEnd" type="System.UInt16" /> 99 <property name="ProfileEnd" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
100 <property name="ProfileCurve" type="System.Byte" /> 100 <property name="ProfileCurve" type="System.Byte" />
101 <property name="ProfileHollow" type="System.UInt16" /> 101 <property name="ProfileHollow" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
102 <property name="TextureEntry" column="Texture" type="System.Byte[]" /> 102 <property name="TextureEntry" column="Texture" type="binary" />
103 <property name="ExtraParams" type="System.Byte[]" /> 103 <property name="ExtraParams" type="binary" />
104 <property name="State" type="System.Byte" /> 104 <property name="State" type="System.Byte" />
105 </component> 105 </component>
106 </class> 106 </class>
@@ -108,7 +108,8 @@
108 <id name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 108 <id name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
109 <generator class="assigned" /> 109 <generator class="assigned" />
110 </id> 110 </id>
111 <property name="Map" type="System.Byte[]" /> 111 <!-- <property name="MapData" type="OpenSim.Data.NHibernate.BlobType, OpenSim.Data.NHibernate" /> -->
112 <property name="MapData" type="binary" />
112 </class> 113 </class>
113 <class name="OpenSim.Framework.TaskInventoryItem, OpenSim.Framework" table="PrimItems" lazy="false"> 114 <class name="OpenSim.Framework.TaskInventoryItem, OpenSim.Framework" table="PrimItems" lazy="false">
114 <id name="ItemID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 115 <id name="ItemID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
@@ -121,15 +122,47 @@
121 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/> 122 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
122 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/> 123 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
123 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/> 124 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
124 <property name="CurrentPermissions" type="System.UInt32" /> 125 <property name="CurrentPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
125 <property name="BasePermissions" type="System.UInt32" /> 126 <property name="BasePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
126 <property name="EveryonePermissions" type="System.UInt32" /> 127 <property name="EveryonePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
127 <property name="GroupPermissions" type="System.UInt32" /> 128 <property name="GroupPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
128 <property name="NextPermissions" type="System.UInt32" /> 129 <property name="NextPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
129 <property name="Name" type="String" length="255" /> 130 <property name="Name" type="String" length="255" />
130 <property name="Description" type="String" length="255" /> 131 <property name="Description" type="String" length="255" />
131 <property name="CreationDate" type="System.UInt32" /> 132 <property name="CreationDate" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
132 <property name="Flags" type="System.UInt32" /> 133 <property name="Flags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
133 <property name="InvType" type="System.Int32" /> 134 <property name="InvType" type="System.Int32" />
134 </class> 135 </class>
136 <class name="OpenSim.Data.RegionProfileData, OpenSim.Data" table="Regions" lazy="false">
137 <id name="Uuid" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
138 <generator class="assigned" />
139 </id>
140 <property name="RegionHandle" index="region_handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
141 <property name="RegionName" index="region_name" type="String" length="32"/>
142 <property name="RegionRecvKey" type="String" length="128"/>
143 <property name="RegionSendKey" type="String" length="128"/>
144 <property name="RegionSecret" type="String" length="128"/>
145 <property name="RegionDataURI" type="String" length="255"/>
146 <property name="ServerIP" type="String" length="64"/>
147 <property name="ServerPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
148 <property name="ServerURI" type="String" length="255"/>
149 <property name="RegionLocX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
150 <property name="RegionLocY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
151 <property name="RegionLocZ" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
152 <property name="EastOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
153 <property name="WestOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
154 <property name="SouthOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
155 <property name="NorthOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
156 <property name="RegionAssetURI" type="String" length="255"/>
157 <property name="RegionAssetRecvKey" type="String" length="128"/>
158 <property name="RegionAssetSendKey" type="String" length="128"/>
159 <property name="RegionUserURI" type="String" length="255"/>
160 <property name="RegionUserRecvKey" type="String" length="128"/>
161 <property name="RegionUserSendKey" type="String" length="128"/>
162 <property name="ServerHttpPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
163 <property name="ServerRemotingPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
164 <property name="RegionMapTextureID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
165 <property name="Owner_uuid" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
166 <property name="OriginUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
167 </class>
135</hibernate-mapping> 168</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
index 0beddaf..e10fb8f 100644
--- a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
@@ -5,7 +5,7 @@
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7 <property name="AgentIP" type="String" length="24" /> 7 <property name="AgentIP" type="String" length="24" />
8 <property name="AgentPort" type="Int32" /> 8 <property name="AgentPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
9 <property name="AgentOnline" type="boolean" /> 9 <property name="AgentOnline" type="boolean" />
10 <property name="SessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 10 <property name="SessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
11 <property name="SecureSessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 11 <property name="SecureSessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
@@ -13,9 +13,9 @@
13 <property name="Region" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 13 <property name="Region" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
14 <property name="LoginTime" type="Int32" /> 14 <property name="LoginTime" type="Int32" />
15 <property name="LogoutTime" type="Int32" /> 15 <property name="LogoutTime" type="Int32" />
16 <property name="Handle" type="Int64" /> 16 <property name="Handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
17 <property name="PositionX" type="Single" /> 17 <!-- <property name="PositionX" type="Single" />
18 <property name="PositionY" type="Single" /> 18 <property name="PositionY" type="Single" />
19 <property name="PositionZ" type="Single" /> 19 <property name="PositionZ" type="Single" /> -->
20 </class> 20 </class>
21</hibernate-mapping> 21</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
index 873930b..740a9f1 100644
--- a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
@@ -9,8 +9,8 @@
9 <property name="PasswordHash" type="String" length="32" /> 9 <property name="PasswordHash" type="String" length="32" />
10 <property name="PasswordSalt" type="String" length="32" /> 10 <property name="PasswordSalt" type="String" length="32" />
11 <property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 11 <property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
12 <property name="HomeRegionX" type="System.UInt32" /> 12 <property name="HomeRegionX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
13 <property name="HomeRegionY" type="System.UInt32" /> 13 <property name="HomeRegionY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
14 <property name="HomeLocationX" type="Single" /> 14 <property name="HomeLocationX" type="Single" />
15 <property name="HomeLocationY" type="Single" /> 15 <property name="HomeLocationY" type="Single" />
16 <property name="HomeLocationZ" type="Single" /> 16 <property name="HomeLocationZ" type="Single" />
diff --git a/OpenSim/Data/NHibernate/Terrain.cs b/OpenSim/Data/NHibernate/Terrain.cs
index dd0da44..88be17f 100644
--- a/OpenSim/Data/NHibernate/Terrain.cs
+++ b/OpenSim/Data/NHibernate/Terrain.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Data.NHibernate
60 set { regionID = value; } 60 set { regionID = value; }
61 } 61 }
62 62
63 public byte[] Map 63 public byte[] MapData
64 { 64 {
65 get { return serializeTerrain(map); } 65 get { return serializeTerrain(map); }
66 set { map = parseTerrain(value); } 66 set { map = parseTerrain(value); }