db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

updating without retrieving

Last post 05-14-2008, 12:20 AM by haiyunw. 4 replies.
Sort Posts: Previous Next
  •  05-13-2008, 09:56 AM 48994

    updating without retrieving

    Hi all ,

    Is it possiable to update and object (assuming its indexed) without retrieving it ?

    I know that the object exist in the DB , I know its values as  well , can't I change one of its value without retrieving it ?

     

    Thanks

  •  05-13-2008, 12:02 PM 49006 in reply to 48994

    Re: updating without retrieving

    No, this is not possible, because db4o uses an reference-cache to decide whether an object is new or already stored into the database. If an object isn't retrieved from database in the current session and therefore not loaded into the reference cache, db4o must think that this is a new object and will store it as new. So you'll end up in duplicates etc.pp.

    What's your exact use-case?

    Cheers, Maik 


    http://db4o.blogspot.com/
  •  05-13-2008, 12:40 PM 49007 in reply to 49006

    Re: updating without retrieving

    Thanks for your replay

    The problem that I am facing is with updaing , I have a global list with a global binding source , I open the databsae once

    When I first retrives the objects from the database I bind datagridview through the binding sorce , Now

    When the user edit one of the text box I would like to update it .

    When the User pressed the Save buttton , the new info. is already in the list , and from some reason when I retrive the info. again from the DB , the new info is there (while I have not set it ???? )

    Where is my mistake ???

     

    Thanks again

  •  05-13-2008, 03:34 PM 49013 in reply to 49007

    Re: updating without retrieving

    Is this what you're looking for?

    http://developer.db4o.com/Resources/view.aspx/Reference/Client-Server/Remote_Code_Execution/Remote_Execution_Through_Evaluation_API

    (RemoteExample.java    - updateCars)

     

  •  05-14-2008, 12:20 AM 49024 in reply to 49006

    Re: updating without retrieving

    Hi there, actually I did the UPDATE in my project. What I tried to do was: instead of updating the object, I just retrieved it, deleted it and stored a new object(since the object fields were totally different). It seemed retrieve was kinda slow even with indexing field(100ms - 200ms). Since the objects will be updated very frequently (1000objects/sec), is there any better solution to increase the performance? My class is very simple, one key field and one data field. thanks.
View as RSS news feed in XML