Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3696922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:47:50+00:00 2026-05-19T04:47:50+00:00

the way i’m using db4o is really just read-only. I will package a db

  • 0

the way i’m using db4o is really just read-only. I will package a db with the application and do some background updating to it every now and again which i can handle differently. But for my activities that are displaying data from the db, i don’t need to do any updates, so for this reason i would just like to get data out of the db and have that data be “deactivated” so when the activity has a configurationChange due to the screen orientation changing or something, i can quickly layout the activity again. What is the proper way to deactivate objects so they are still usable to my activity . Currently i have code something like

List<MyObject> mList = db().queryByExample(persistentClass);  // db just gets my ObjectContainer

I have tried doing something like this

db().ext().deactivate(mList);

but it has not seemed to work.Do i need to iterate through each item of the list to deactivate it?

when you change the screen orientation on the android, it hits my activity close method where i close the database. but then starts back up and I don’t want to populate the mList again.

so i keep getting a “com.db4o.ext.DatabaseClosedException” exception because in my layout of the activity i do things like

mList.size()

I really just want to deactivate the objects b/c i never have to update them, how can i do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:47:51+00:00Added an answer on May 19, 2026 at 4:47 am

    Well first, you want ensure that all objects are loaded. db4o only returns a lazy loading list, which loads object when you access them. You need to copy your objects to a regular list which doesn’t require a running database. This is quite simple, just pass the result of the query to a new array list:

     List<MyObject> mList = new ArrayList<MyObject>(db().queryByExample(persistentClass)); 
    

    Now you shouldn’t get a DatabaseClosedException.

    Then I just want to add that the ‘deactivation’ in db4o is something completely different. It has to do with the Activation-mechanism. Deactivation is the opposite of activation. Activation loads to object from the database into memory. Deactivation makes the object in memory to an empty hull with no data in it. Explicit deactivation is only useful for special scenarios to safe memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whichever way I do it, it seems something goes wrong when using the conditional
Is there a way to enforce constraint checking in MSSQL only when inserting new
Is there any way to check whether a file is locked without using a
I have just tried to save a simple *.rtf file with some websites and
Way back in the days when delicious was just del.icio.us, I had assumed that
A way that doesn't hog resources, just stops execution for 1 second then executes?
Any way to do this? Replace function only replaces first instance. Thanks.
Is there a way to test if a collection is already initialized? try-catch only?
I am attempting to pull some information from my tnsnames file using regex. I
Which way do you prefer to create your forms in MVC? <% Html.Form() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.