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

  • SEARCH
  • Home
  • 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 8460457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:36:47+00:00 2026-06-10T13:36:47+00:00

I am using db4o 8.0. I have a class PostedMessage{ @Indexed long receivedTime; @Indexed

  • 0

I am using db4o 8.0.

I have a class

PostedMessage{
    @Indexed
    long receivedTime;
    @Indexed
    long sentTime;
    ...    
    //getter methods and setter methods for all the fields.
}

I persist the PostedMessage objects to db4o database. I have already saved 15000+ objects to db4o database. And now when I run following query, it results in OutOfMemoryError.

    //Query to get PostedMessages between "start" and "end" dates.
    Query q = db.query();
    q.constrain(PostedMessage.class);
    Constraint from = q.descend("receivedTime").constrain(new Long(start.getTimeInMillis())).greater().equal();
    q.descend("receivedTime").constrain(new Long(end.getTimeInMillis())).smaller().equal().and(from);
    q.execute();//results in OutOfMemoryError

To avoid the OutOfMemoryError, I need to add indexes to the fields of PostedMessage class. Read This.

I have a server/client configuration. I don’t have control over pre-configuring the ObjectContainer before opening it.

I will have to apply/append the indexing CommonConfiguration after the ObjectContainer is just opened and provided to me.

I know how to create the config.

    EmbeddedConfiguration appendConfig = Db4oEmbedded.newConfiguration();
    appendConfig.common().objectClass(EmailMessage.class).objectField("receivedTime").indexed(true);
    appendConfig.common().objectClass(EmailMessage.class).objectField("sentTime").indexed(true);

I am not able to figure out how to apply this config to already opened ObjectContainer.
How can I add indexes to the just opened ObjectContainer?

Is EmbeddedConfigurationItem’s apply() method the answer? If it is, can I get a sample code that shows how to use it?

Edited : Added @Indexed annotation later to the question.

  • 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-06-10T13:36:49+00:00Added an answer on June 10, 2026 at 1:36 pm

    cl-r’s suggestion of using TA/TP worked like a charm in my case. See his comment above.

    You have also to install Transparent Activation/Transparent
    Persistence to avoid to load unnecessary object in memmory. Look at
    chapter 10&11 in tutorial (in the doc/tutorial directory of the
    downloaded db4o[Version].zip] – cl-r

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

Sidebar

Related Questions

I have a Maven project and added db4o as a dependency using this answer
I am using db4o as DBMS and I have a question: Is there any
Is using Db4o as a backend datastore for a Web site (ASP.NET MVC) a
I'm using db4o for a simple app, with an embedded db. When I save
I just started using db4o on C#, and I'm having trouble setting the UniqueConstraint
Using the Redis info command, I am able to get all the stats of
I am a new to db4o. I have a big problem with persistance of
I'm playing around with building a new web application using DB4O - piles of
i am using db4o in a asp.net web application, as you know when db4o
is it possible in Db4o to load new objects into persistent IObjectContainer? I have

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.