db4o Developer Community

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

callback for activated event

  •  10-25-2007, 07:15 AM

    callback for activated event

    Hi,

    I had problem with activating object and its callback. I don't know if behaviour of activating is correct.

    Originall snippet of code:

    Pilot jan = new Pilot("Jan", null);
    this.db.set(jan);

    this.db.ext().activate(jan, 1);     //I'm trying to activate object, which was stored into db. Why after setting to db the object isn't activated?

    boolean activePilot = this.db.ext().isActive(jan);
    System.out.println("pilot is active:" + activePilot);   //it returns false!!!

    this.db.ext().deactivate(jan, 1);
    activePilot = test.db.ext().isActive(jan);
    System.out.println("pilot is active:" + activePilot); //of course it's right that it's false

    ObjectSet result = this.db.get(new Pilot("Jan", null));
    Pilot pilot = (Pilot) result.get(0);
    activePilot = test.db.ext().isActive(pilot);
    System.out.println("pilot is active:" + activePilot); //finally pilot is active BUT activating did not fire activated event

     

    So there are 3 problems for me:

    • Why storing object does not activate that object - I don't know maybe it must be
    • Switching of activating state does not work
    • After retrieving of object from db "activated" event is not fired


    My solution is

    • closing and opening database befrore retrieving object from database
    • calling this.db.ext().refresh(pilot, 1); after inserting to database - I use this

    Is right to call refresh() method? And what about those problems?

     

    But on the other way I have to thank you for such excellent programme. Nice coded, well documentated, with "other" access to data. Well done!!!

    thank you

    Jan 


    Jan Chodura
    Filed under: ,
View Complete Thread