[Opensim-dev] DB - NHibernate tests (part 1)

jon cundill jcundill at gmail.com
Wed Feb 13 00:38:21 UTC 2008


Hi Impalah

See you've made good progress on assets

attached is zip of IUserData hibernate impl

Had to patch FriendItemList - also attached -, but otherwise existing
opensim objects are untouched.

created a project OpenSim.Framework.Data.Hibernate to enclose this and set

userDatabase_plugin = "OpenSim.Framework.Data.Hibernate.dll"

in OpenSim.ini to get it to work. -only tested standalone and MySQL
i'm afraid - Used your HibernateSessionManager to get it started in
the session.

This copes with UserProfileData, UserAgentData and FriendItemList -
users, agents and userfriends in the DB.

_Only_ thing I can't do is set the reverse reference to
FriendItemListOwnerPerms at the mo as this needs to be a formula
property - not DB property, and NHibernate is not playing well here -
wouldn't this be much easier in java on hibernate 3.2 :)

Changed the Naming from OpenSim.Framework.Data.NHibernate to
OpenSim.Framework.Data.Hibernate to be in line with what you are
doing. So if attached project doesn;t compile for u that is probably
the problem.


I have a unit test for all the operations on IUserData which will mail
tomorrow - need to fix up as there is no Delete in IUserData for the
unit tests and I don't want to mess with the existing classes if I can
avoid.

Have also made a start on InventoryFolderBase and InventoryItemBase -
but am struggling a bit as this really wants to be a composite pattern
- but not expressed in the objects, will sort out a hack in the dao as
a workaround rather than touch the domain classes.

Hope to get this sorted over next day or two.

All the stuff related to prims , primshapes, primitems looks tricky
without touching the opensim classes - we'll put this off till last
yes?

Can you merge and let me have a copy of what you have done?

Best

jonc

jcundill at hotmail.com on MSN if u want to chat










On 12/02/2008, Impalah <impalah at gmail.com> wrote:
> Second report:
> ---------------------------------
>
> - Created a new assembly: Opensim.Framework.Data.Hibernate.
> - Opensim.ini: new configuration ===> asset_database = "hibernate"
>
> Every other server, example: inventory_plugin =
> "OpenSim.Framework.Data.Hibernate.dll"
>                                        * I don't want to do
> deep changes now so it is implemented as a plugin like the others (mysql,
> sqlite...)
> - Changes in database: minimums by now, only some primary keys created and
> TEXT fields changed to VARCHAR
>  - All the database objects mapped to hibernate.
> - Tested on MySQL. When completed will be tested in sqlite & mssql (maybe
> oracle if I have time)
> - Status: Opensim starts up step by step until
> RegionApplicationBase.SetupScene. I have stopped (I'm very
> tired :-P, today I coded 10 hours w/o rest )
> inscene.performParcelPrimCountUpdate();
>
> Well, seems that is quite easy to make the change, but is really really
> really sloooooooow. I hope in 5 or 6 days could have a stable server, then I
> will upload the files and documentation where you tell me.
>
> Greetingzzz
>
>
>
> 2008/2/12, Impalah <impalah at gmail.com>:
> > Hi everyone:
> >
> > I'm integrating the Hibernate model yet into my local opensim (downloaded
> 5/februay).
> >
> > By now I'm trying to work with assets and seems to work ok, except for the
> first time loading from xml. The PK of the table is the UUID of the assets
> and seems that hibernate works only in two modes: it asigns automatically
> id's or the applicaion creates the ids.
> >
> > Well, a little problem I think I could resolve today, but we won't use all
> the power of hibernate in some cases...
> >
> > That's all. I'll keep you informed.
> >
> > Greetingzzz
> >
> >
> >
> >
> > 2008/2/7, Impalah <impalah at gmail.com>:
> >
> > > In opensim "in general" I don't know.
> > > In the case of this example... it's just an example, you can change what
> you need, the DB configuration is "transparent" for nhibernate.
> > >
> > >
> > >
> > > 2008/2/7, Kyle Hamilton <aerowolf at gmail.com>:
> > >
> > > >
> > > >
> > > > Just out of curiosity... Is there a specific reason we're not using
> utf8 unicode encoding for the tables?  Is there something that will break if
> utf8 is used?
> > > >
> > > >
> > > > -Kyle H
> > > >
> > > > Sent from my iPhone
> > > >
> > > >
> > > > On Feb 7, 2008, at 1:40, Impalah <impalah at gmail.com> wrote:
> > > >
> > > >
> > > >
> > > >
> > > > Sorry I made a mistake in the sql file.
> > > >
> > > > The good one is copied below.
> > > >
> > > > I'm working now on the "persistence" layer, creating the basic
> utilities (i.e. factories) and testing selects, updates and deletes.
> > > >
> > > > I hope in 2 or 3 days to have something "insertable" into the actual
> opensim.
> > > >
> > > >
> > > >
> > > > CREATE DATABASE `opensimtest` /*!40100 DEFAULT CHARACTER SET latin1
> */;
> > > >
> > > > DROP TABLE IF EXISTS
> `opensimtest`.`osprimitive_type`;
> > > > CREATE TABLE  `opensimtest`.`osprimitive_type` (
> > > >   `id` int(10) unsigned NOT NULL auto_increment,
> > > >   `name` varchar(45) NOT NULL,
> > > >   `params` varchar(45) NOT NULL,
> > > >   PRIMARY KEY  (`id`)
> > > > ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
> > > >
> > > >
> > > > DROP TABLE IF EXISTS `opensimtest`.`ostexture`;
> > > > CREATE TABLE  `opensimtest`.`ostexture` (
> > > >   `id` int(10) unsigned NOT NULL auto_increment,
> > > >   `uuid` varchar(45) NOT NULL,
> > > >   `name` varchar(45) NOT NULL,
> > > >   `path` varchar(45) NOT NULL,
> > > >   `data` blob NOT NULL,
> > > >   PRIMARY KEY  (`id`)
> > > > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
> > > >
> > > > DROP TABLE IF EXISTS `opensimtest`.`osuser`;
> > > > CREATE TABLE  `opensimtest`.`osuser` (
> > > >   `id` int(10) unsigned NOT NULL auto_increment,
> > > >   `uuid` varchar(45) NOT NULL,
> > > >   `name` varchar(45) NOT NULL,
> > > >   `surname` varchar(45) NOT NULL,
> > > >   `last_position` varchar(45) NOT NULL,
> > > >   PRIMARY KEY  (`id`)
> > > > ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
> > > >
> > > >
> > > >
> > > > DROP TABLE IF EXISTS `opensimtest`.`osfaces`;
> > > > CREATE TABLE  `opensimtest`.`osfaces` (
> > > >   `id` int(10) unsigned NOT NULL auto_increment,
> > > >   `face` varchar(45) NOT NULL,
> > > >   `id_texture` int(10) unsigned zerofill NOT NULL default
> '0000000000',
> > > >   `params` varchar(45) NOT NULL,
> > > >   PRIMARY KEY  (`id`),
> > > >   KEY `FK_ostexture_faces_texture` (`id_texture`),
> > > >   CONSTRAINT `FK_ostexture_faces_texture` FOREIGN KEY (`id_texture`)
> REFERENCES `ostexture` (`id`)
> > > > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
> > > >
> > > > DROP TABLE IF EXISTS `opensimtest`.`osprimitive`;
> > > > CREATE TABLE  `opensimtest`.`osprimitive` (
> > > >   `id` int(10) unsigned NOT NULL auto_increment,
> > > >   `name` varchar(45) default NULL,
> > > >   `description` varchar(45) default NULL,
> > > >   `uuid` varchar(45) NOT NULL,
> > > >   `id_primitive_type` int(10) unsigned NOT NULL,
> > > >   `id_creator` int(10) unsigned NOT NULL,
> > > >   `id_owner` int(10) unsigned NOT NULL,
> > > >   PRIMARY KEY  (`id`),
> > > >   KEY `FK_osprimitive_type` (`id_primitive_type`),
> > > >   KEY `FK_osprimitive_creator` (`id_creator`),
> > > >   KEY `FK_osprimitive_owner` (`id_owner`),
> > > >   CONSTRAINT `FK_osprimitive_type` FOREIGN KEY (`id_primitive_type`)
> REFERENCES `osprimitive_type` (`id`),
> > > >   CONSTRAINT `FK_osprimitive_creator` FOREIGN KEY (`id_creator`)
> REFERENCES `osuser` (`id`),
> > > >   CONSTRAINT `FK_osprimitive_owner` FOREIGN KEY (`id_owner`)
> REFERENCES `osuser` (`id`)
> > > > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 2008/2/7, Sean Dague <sean at dague.net>:
> > > > > On Wed, Feb 06, 2008 at 11:06:14PM +0100, Impalah wrote:
> > > > > > Hi everyone:
> > > > > >
> > > > > > I've uploaded a file to my web page with a c# project testing
> NHibernate:
> > > > > >
> http://ai-designstudio.net/index.php?option=com_docman&task=doc_details&gid=40&Itemid=88889037&lang=en
> > > > > >
> > > > > > Please, does not expect a miracle right now, it's just only a
> massive
> > > > > > insertion test for checking if everything runs ok.
> > > > >
> > > > > Thanks for all of this work.  I just pulled the source and am going
> to
> > > > > poke it a bunch tomorrow.  More comments as I get up to speed on
> this.
> > > > >
> > > > >      -Sean
> > > > >
> > > > > --
> > > > >
> __________________________________________________________________
> > > > >
> > > > > Sean Dague
> Mid-Hudson Valley
> > > > > sean at dague dot net
> Linux Users Group
> > > > > http://dague.net
> http://mhvlug.org
> > > > >
> > > > > There is no silver bullet.  Plus, werewolves make better neighbors
> > > > > than zombies, and they tend to keep the vampire population down.
> > > > >
> __________________________________________________________________
> > > > >
> > > > > -----BEGIN PGP SIGNATURE-----
> > > > > Version: GnuPG v1.4.6 (GNU/Linux)
> > > > >
> > > > >
> iD8DBQFHqnZgSamXem9TdyYRApuZAJ9dzX9sZn5CYb5GYu4xQkTRI6XWLACfTHxf
> > > > > wditTaO4gROrub+bL0rPI2w=
> > > > > =fqU2
> > > > > -----END PGP SIGNATURE-----
> > > > >
> > > > > _______________________________________________
> > > > > Opensim-dev mailing list
> > > > > Opensim-dev at lists.berlios.de
> > > > >
> https://lists.berlios.de/mailman/listinfo/opensim-dev
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Opensim-dev mailing list
> > > > Opensim-dev at lists.berlios.de
> > > > https://lists.berlios.de/mailman/listinfo/opensim-dev
> > > >
> > > > _______________________________________________
> > > > Opensim-dev mailing list
> > > > Opensim-dev at lists.berlios.de
> > > > https://lists.berlios.de/mailman/listinfo/opensim-dev
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Data.Hibernate.Users.zip
Type: application/zip
Size: 106521 bytes
Desc: not available
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080213/439809cc/attachment-0001.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FriendItemList.patch
Type: application/octet-stream
Size: 1872 bytes
Desc: not available
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080213/439809cc/attachment-0001.obj>


More information about the Opensim-dev mailing list