aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorSean Dague2008-04-09 18:04:03 +0000
committerSean Dague2008-04-09 18:04:03 +0000
commitce5e51240f6bfb6e0bd524c4cb13d577c92f789c (patch)
tree600f9a769e97302e93cbda13da3a2a9b869610d8 /OpenSim/Data/NHibernate
parentmore futzing around here. None of this works yet because (diff)
downloadopensim-SC-ce5e51240f6bfb6e0bd524c4cb13d577c92f789c.zip
opensim-SC-ce5e51240f6bfb6e0bd524c4cb13d577c92f789c.tar.gz
opensim-SC-ce5e51240f6bfb6e0bd524c4cb13d577c92f789c.tar.bz2
opensim-SC-ce5e51240f6bfb6e0bd524c4cb13d577c92f789c.tar.xz
NHibernate Inventory support. Lightly tested, but seems to work
well enough on my test environment. Will need to add some exception catching down the road. On to User Store.
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs22
-rw-r--r--OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml2
2 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index f99273a..a004e29 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -298,7 +298,7 @@ namespace OpenSim.Data.NHibernate
298 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 298 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
299 { 299 {
300 using(ISession session = factory.OpenSession()) { 300 using(ISession session = factory.OpenSession()) {
301 try { 301 // try {
302 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); 302 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
303 criteria.Add(Expression.Eq("Folder", folderID) ); 303 criteria.Add(Expression.Eq("Folder", folderID) );
304 List<InventoryItemBase> list = new List<InventoryItemBase>(); 304 List<InventoryItemBase> list = new List<InventoryItemBase>();
@@ -307,9 +307,9 @@ namespace OpenSim.Data.NHibernate
307 list.Add(item); 307 list.Add(item);
308 } 308 }
309 return list; 309 return list;
310 } catch { 310// } catch {
311 return new List<InventoryItemBase>(); 311// return new List<InventoryItemBase>();
312 } 312// }
313 } 313 }
314 } 314 }
315 315
@@ -322,7 +322,7 @@ namespace OpenSim.Data.NHibernate
322 public InventoryFolderBase getUserRootFolder(LLUUID user) 322 public InventoryFolderBase getUserRootFolder(LLUUID user)
323 { 323 {
324 using(ISession session = factory.OpenSession()) { 324 using(ISession session = factory.OpenSession()) {
325 try { 325 // try {
326 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); 326 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
327 criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) ); 327 criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) );
328 criteria.Add(Expression.Eq("Owner", user) ); 328 criteria.Add(Expression.Eq("Owner", user) );
@@ -332,9 +332,9 @@ namespace OpenSim.Data.NHibernate
332 } 332 }
333 m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user); 333 m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user);
334 return new InventoryFolderBase(); 334 return new InventoryFolderBase();
335 } catch { 335// } catch {
336 return new InventoryFolderBase(); 336// return new InventoryFolderBase();
337 } 337// }
338 } 338 }
339 } 339 }
340 340
@@ -347,9 +347,9 @@ namespace OpenSim.Data.NHibernate
347 { 347 {
348 using(ISession session = factory.OpenSession()) { 348 using(ISession session = factory.OpenSession()) {
349 // try { 349 // try {
350 IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent"); 350 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
351 query.SetParameter("parent", parentID, NHibernateUtil.Custom(typeof(LLUUIDUserType))); 351 criteria.Add(Expression.Eq("ParentID", parentID) );
352 foreach (InventoryFolderBase item in query.List()) 352 foreach (InventoryFolderBase item in criteria.List())
353 { 353 {
354 folders.Add(item); 354 folders.Add(item);
355 } 355 }
diff --git a/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml
index 71a6602..4411071 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="short" /> 7 <property name="Type" type="short" />
8 <property name="Version" type="short" /> 8 <property name="Version" type="UInt16" />
9 <property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" /> 9 <property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
10 <property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" /> 10 <property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
11 <property name="Name" type="String" length="64" /> 11 <property name="Name" type="String" length="64" />