db4o Developer Community
Developer Community db4o open source object database, native to Java and .NET
Register   |  Login
  Search
  • Forums
  • Documentation
  • Resources
  • Downloads
  • Blogs
  • About
Unanswered Active Topics Forums
Forums > English Forums > db4o User Forum
Generics and db4o V7.4 for .NET 3.5
Last Post 01 Jul 2009 04:21 AM by Gil.Y. 10 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Gil.Y
New Member
New Member
Gil.Y

--
30 Jun 2009 05:37 AM  

I trying out db4o to build an ERP system.
All went well until trying to update a structure like this: (shorttened)

public Company
{
    public IList<Module> Modules{get;set;}

    //in the constructor I initalize this with : Modules = new List<Module>();
}

It seems that the first time I store the instance of a company all going well.
However: loading the company, adding a module to the modules list and than trying to store (update) will refuse to store the new updated list.
No error will occur but the next time I execute the application the modules list is without the addtional module.
Even without restarting the application trying few times to read the instance of the company will eventually show the truth - which is the addtional module was not really saved.

I'm using the stable version 7.4 for .net 3.5.

PLEASE HELP! I DON'T WANT TO GO BACK TO SQL!!!

Regards,
Gil

gamlerhart
Basic Member
Basic Member
Posts:404
gamlerhart

--
30 Jun 2009 06:05 AM  

Have you configured the right update-depth? When you update an object, only its direct members (ints, floats, strings) will be updated. The list is considered as a reference to another objects. So you have to store it explicit or set the update-depth higher:

http://developer.db4o.com/Resources...date_Depth

http://developer.db4o.com/Resources...ed_Objects



Gil.Y
New Member
New Member
Gil.Y

--
30 Jun 2009 06:47 AM  

Yes I did.

I tried setting:

Db4oFactory.Configure().ObjectClass(typeof (Companyt)).UpdateDepth(10);
Db4oFactory.Configure().ObjectClass(typeof (Sample)).CascadeOnUpdate(true);

It didn't solve anything - I got the exact same behavior as before.

Gil.Y
New Member
New Member
Gil.Y

--
30 Jun 2009 06:51 AM  

Yes I did.

I tried the followings with no success,

Db4oFactory
.Configure().ObjectClass(typeof(Company)).UpdateDepth(10);

Db4oFactory.Configure().ObjectClass(typeof (Company)).CascadeOnUpdate(true);

getting the exact same behavior..

Adriano Verona
Basic Member
Basic Member
Posts:326
Adriano Verona

--
30 Jun 2009 07:24 AM  

Hi.

On version 7.4 generic collections handling has issues. 

These issues were fixed on version 7.7. (For more information take a look at http://developer.db4o.com/forums/th...2219.aspx)

Can you try with latest version ?

Best

Adriano

Gil.Y
New Member
New Member
Gil.Y

--
30 Jun 2009 08:33 AM  

Thanks Adriano, 

Here are the results while trying the same tests with the following versions:

db4o 7.7   for asp.net 3.5 - same results - it is not working.
db4o 7.10 for asp.net 3.5 - same results - it is not working.

This either means "it is not working" or i'm not using it correctly, so if possible:
I'd like to see a working example of C# .Net 3.5 (vs2008) application able to store and afterwards update an object with generic collections of non-primitve type.

Thanks
Gil.

rst
New Member
New Member
Posts:42
rst

--
30 Jun 2009 09:32 AM  

I think I've got what you're writing about and I received the same situation.

Now I've got the working code that should solve your issue. if you want I can put it here with explanations or put on file storage somewhere (or send on e-mail, if you want)


in a few words, you should change the configuration with adding special configuration line for the Container class (class that owns the collection)

you should specify CascadeOnUpdate(true) for this class.

Gil.Y
New Member
New Member
Gil.Y

--
30 Jun 2009 02:04 PM  

please send me to this email: gil.yadid@gmail.com

Thank You!!

The code is for vs2008 .net 3.5 I hope.

Gil.Y
New Member
New Member
Gil.Y

--
01 Jul 2009 04:18 AM  

This issue is solved thanks to Adriano and to RST.

The solution is to use :

DB =
Db4oFactory.OpenFile(Db4oFactory.Configure(), DBPath);
Db4oFactory.Configure().ObjectClass(typeof(Sample)).CascadeOnUpdate(true);

The problem was I used:
DB = Db4oFactory.OpenFile(DBPath);
Db4oFactory.Configure().ObjectClass(typeof(Sample)).CascadeOnUpdate(true);

As you can see I was assuming that the global configuration is being taken into considration by default.
However it is not...
I suggest either a global configuration be taken into considration by default
OR to change the name in the documantion from "global configuration" to "stand-alone configuration" and to mention that it is not activated by default.

Thank you,
Gil.

Gil.Y
New Member
New Member
Gil.Y

--
01 Jul 2009 04:21 AM  

One last note: it was tested for v7.10 for .net 3.5, I didn't test it for 7.4.

 

Adriano Verona
Basic Member
Basic Member
Posts:326
Adriano Verona

--
02 Jul 2009 05:04 AM  

Hi

May it be a "activation depth" problem?

Regarding a sample, I guess that you  can look either in the turorial or in db4o test suite.

Let me known If you have any problem finding the samples.

 

Best

Adriano

You are not authorized to post a reply.
Forums > English Forums > db4o User Forum

Active Forums 4.2
Close
Copyright ©2000-2010 by Versant Corp.
Privacy Policy