LLUUID mapper actually appears to work now with

NHibernate for Assets.
0.6.0-stable
Sean Dague 2008-04-08 13:49:10 +00:00
parent 0c601b7312
commit 214bd204b1
4 changed files with 13 additions and 13 deletions

View File

@ -67,11 +67,11 @@ namespace OpenSim.Data.NHibernate
cfg.AddAssembly("OpenSim.Data.NHibernate"); cfg.AddAssembly("OpenSim.Data.NHibernate");
HbmSerializer.Default.Validate = true; HbmSerializer.Default.Validate = true;
// using ( System.IO.MemoryStream stream = using ( System.IO.MemoryStream stream =
// HbmSerializer.Default.Serialize(System.Reflection.Assembly.GetExecutingAssembly())) HbmSerializer.Default.Serialize(System.Reflection.Assembly.GetExecutingAssembly()))
// cfg.AddInputStream(stream); cfg.AddInputStream(stream);
// new SchemaExport(cfg).Create(true, true); // new SchemaExport(cfg).Create(true, true);
factory = cfg.BuildSessionFactory(); factory = cfg.BuildSessionFactory();
} }
@ -80,7 +80,7 @@ namespace OpenSim.Data.NHibernate
{ {
using(ISession session = factory.OpenSession()) { using(ISession session = factory.OpenSession()) {
try { try {
return session.Load(typeof(AssetBase), uuid.ToString()) as AssetBase; return session.Load(typeof(AssetBase), uuid) as AssetBase;
} catch { } catch {
return null; return null;
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false"> <class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false">
<id name="FullID" column="UUID" type="OpenSim.Data.NHibernate.LLUUIDString"> <id name="FullID" column="UUID" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>
<property name="Type" type="SByte" /> <property name="Type" type="SByte" />

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.InventoryItemBase, OpenSim.Framework" table="InventoryItems" lazy="false"> <class name="OpenSim.Framework.InventoryItemBase, OpenSim.Framework" table="InventoryItems" lazy="false">
<id name="ID" type="OpenSim.Data.NHibernate.LLUUIDString"> <id name="ID" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>
<property name="InvType" type="int" /> <property name="InvType" type="int" />
<property name="AssetType" type="int" /> <property name="AssetType" type="int" />
<property name="AssetID" type="OpenSim.Data.NHibernate.LLUUIDString" /> <property name="AssetID" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate" />
<property name="Folder" type="OpenSim.Data.NHibernate.LLUUIDString" /> <property name="Folder" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate" />
<property name="Owner" type="OpenSim.Data.NHibernate.LLUUIDString" /> <property name="Owner" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate" />
<property name="Creator" type="OpenSim.Data.NHibernate.LLUUIDString" /> <property name="Creator" type="OpenSim.Data.NHibernate.LLUUIDString, OpenSim.Data.NHibernate" />
<property name="Name" type="String" length="64" /> <property name="Name" type="String" length="64" />
<property name="Description" type="String" length="64" /> <property name="Description" type="String" length="64" />
<property name="NextPermissions" type="uint" /> <property name="NextPermissions" type="uint" />

View File

@ -57,6 +57,7 @@ namespace OpenSim.Data.NHibernate
{ {
LLUUID UUID = (LLUUID)obj; LLUUID UUID = (LLUUID)obj;
((IDataParameter)cmd.Parameters[index]).Value = UUID.ToString(); ((IDataParameter)cmd.Parameters[index]).Value = UUID.ToString();
System.Console.WriteLine("Setting UUID {0}", UUID.ToString());
} }
public object Replace(object original, object target, object owner) public object Replace(object original, object target, object owner)
@ -71,8 +72,7 @@ namespace OpenSim.Data.NHibernate
public SqlType[] SqlTypes public SqlType[] SqlTypes
{ {
// I think we're up to 36 get { return new SqlType [] { SqlTypeFactory.GetString(32) }; }
get { return new SqlType [] { SqlTypeFactory.GetString(36) }; }
} }
} }
} }