getting close on saving prims via nhibernate
parent
44d0b7c724
commit
6adac3bd5a
|
@ -34,6 +34,7 @@ using libsecondlife;
|
|||
using log4net;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Expression;
|
||||
using NHibernate.Mapping.Attributes;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using OpenSim.Framework;
|
||||
|
@ -123,12 +124,15 @@ namespace OpenSim.Data.NHibernate
|
|||
{
|
||||
try
|
||||
{
|
||||
m_log.InfoFormat("Storing part {0}", part.UUID);
|
||||
session.SaveOrUpdate(part);
|
||||
session.Flush();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("Can't save: ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -151,8 +155,33 @@ namespace OpenSim.Data.NHibernate
|
|||
/// <returns>List of loaded groups</returns>
|
||||
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
|
||||
{
|
||||
List<SceneObjectGroup> prims = new List<SceneObjectGroup>();
|
||||
return prims;
|
||||
Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>();
|
||||
List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
|
||||
|
||||
ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
|
||||
criteria.Add(Expression.Eq("RegionID", regionUUID));
|
||||
criteria.AddOrder( Order.Asc("ParentID") );
|
||||
foreach (SceneObjectPart p in criteria.List())
|
||||
{
|
||||
// root part
|
||||
if (p.UUID == p.ParentUUID)
|
||||
{
|
||||
SceneObjectGroup group = new SceneObjectGroup();
|
||||
group.AddPart(p);
|
||||
group.RootPart = p;
|
||||
SOG.Add(p.ParentUUID, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
SOG[p.ParentUUID].AddPart(p);
|
||||
}
|
||||
}
|
||||
foreach (SceneObjectGroup g in SOG.Values)
|
||||
{
|
||||
ret.Add(g);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -215,7 +244,7 @@ namespace OpenSim.Data.NHibernate
|
|||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
|
||||
session.Flush();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="OpenSim.Region.Environment.Scenes.SceneObjectPart, OpenSim.Region.Environment" table="Prims" lazy="false">
|
||||
<id name="UUID" column="ID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
|
||||
<id name="UUID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
|
||||
<generator class="assigned" />
|
||||
</id>
|
||||
<property name="ParentID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||
|
@ -56,9 +56,9 @@
|
|||
</property>
|
||||
|
||||
<property name="SitTargetPositionLL" type="OpenSim.Data.NHibernate.LLVector3UserType, OpenSim.Data.NHibernate" >
|
||||
<column name="SitTargetPosX" />
|
||||
<column name="SitTargetPosY" />
|
||||
<column name="SitTargetPosZ" />
|
||||
<column name="SitTargetOffsetX" />
|
||||
<column name="SitTargetOffsetY" />
|
||||
<column name="SitTargetOffsetZ" />
|
||||
</property>
|
||||
|
||||
<property name="RotationOffset" type="OpenSim.Data.NHibernate.LLQuaternionUserType, OpenSim.Data.NHibernate" >
|
||||
|
|
Loading…
Reference in New Issue