more futzing around here. None of this works yet because

bloody LLUUID isn't serializable, which is really annoying.
0.6.0-stable
Sean Dague 2008-04-09 16:01:57 +00:00
parent 8bd1f1c7c3
commit 4cc3aad2f9
2 changed files with 9 additions and 8 deletions

View File

@ -31,6 +31,7 @@ using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using NHibernate; using NHibernate;
using NHibernate.Expression;
using NHibernate.Cfg; using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl; using NHibernate.Tool.hbm2ddl;
using NHibernate.Mapping.Attributes; using NHibernate.Mapping.Attributes;
@ -298,10 +299,10 @@ namespace OpenSim.Data.NHibernate
{ {
using(ISession session = factory.OpenSession()) { using(ISession session = factory.OpenSession()) {
try { try {
IQuery query = session.CreateQuery("from InventoryItems i where i.Folder = :folder"); ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
query.SetString("folder", folderID.ToString()); criteria.Add(Expression.Eq("Folder", folderID) );
List<InventoryItemBase> list = new List<InventoryItemBase>(); List<InventoryItemBase> list = new List<InventoryItemBase>();
foreach (InventoryItemBase item in query.List()) foreach (InventoryItemBase item in criteria.List())
{ {
list.Add(item); list.Add(item);
} }
@ -322,10 +323,10 @@ namespace OpenSim.Data.NHibernate
{ {
using(ISession session = factory.OpenSession()) { using(ISession session = factory.OpenSession()) {
try { try {
IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent and i.Owner = :owner"); ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
query.SetParameter("parent", LLUUID.Zero, NHibernateUtil.Custom(typeof(LLUUIDUserType))); criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) );
query.SetParameter("owner", user, NHibernateUtil.Custom(typeof(LLUUIDUserType))); criteria.Add(Expression.Eq("Owner", user) );
foreach (InventoryFolderBase folder in query.List()) foreach (InventoryFolderBase folder in criteria.List())
{ {
return folder; return folder;
} }

View File

@ -67,7 +67,7 @@ namespace OpenSim.Data.NHibernate
public Type ReturnedType public Type ReturnedType
{ {
get { return typeof(Guid); } get { return typeof(LLUUID); }
} }
public SqlType[] SqlTypes public SqlType[] SqlTypes