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 4021350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:20:27+00:00 2026-05-20T10:20:27+00:00

Run into a tricky problem with db4o and a simple nested structures. Problem: when

  • 0

Run into a tricky problem with db4o and a simple nested structures.

Problem: when I use LINQ to pull data out of db4o, its pulling out too much data (i.e. the “where” clause doesn’t seem to be working).

I have some nested objects:

Root ----Symbol (SPX)                
   |          |------Day 1: Date: 2010-10-18, string "SPX meta"
   |          |------Day 2: Date: 2010-10-19, string "SPX meta"
   |
   |
   |-----Symbol (IBM)               
              |------Day 1: Date: 2010-10-18, string "IBM meta"
              |------Day 2: Date: 2010-10-19, string "IBM meta"

I create two symbols:

  Symbol sym1 = new Symbol("SPX");
  Symbol sym2 = new Symbol("IBM");

I then create some trading days:

  // SPX
  TradingDay day1 = new TradingDay(new DateTime(2010, 10, 18), "SPX meta");
  TradingDay day2 = new TradingDay(new DateTime(2010, 10, 19), "SPX meta");

  // IBM
  TradingDay day3 = new TradingDay(new DateTime(2010, 10, 18), "IBM meta");
  TradingDay day4 = new TradingDay(new DateTime(2010, 10, 19), "IBM meta");

I then assign a couple of days to each symbols:

  sym1.AssignTradingDay(day1);
  sym1.AssignTradingDay(day2);

  sym2.AssignTradingDay(day3);
  sym2.AssignTradingDay(day4);

I then persist it to the db4o object database:

  // Store in the database.
  db4o.db.Store(sym1);
  db4o.db.Store(sym2);
  db4o.db.Commit();  

Pretty simple so far.

I check the database with “db4o Object Manager Enterprise”, and sure enough, there is two symbols, and if I click on each symbol, each one contains two days.

Now, I do a LINQ query to pull the data out:

 var daysForSymbolS1 = from Symbol s in db4o.db
                       from TradingDay t in db4o.db
                       where (s.SymbolGlobal == "IBM" 
                              && t.Date == new DateTime(2010, 10, 19))
                       select new
                       {
                         s.SymbolGlobal,
                         t.Date,
                         t.Meta
                       };
 foreach (var d in daysForSymbolS1)
 {
   Console.WriteLine("{0} - {1} - {2}", d.SymbolGlobal, d.Date.Date, d.Meta);
 } 

And, something weird happens:

IBM - 10/19/2010 12:00:00 AM - SPX meta     // This line should not appear because we have specified "IBM" in the filter.
IBM - 10/19/2010 12:00:00 AM - IBM meta

Despite the fact that I specified that it should only return data for “SPX” its returning data from “IBM” as well.

Am I doing anything obviously wrong?

  • 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-20T10:20:27+00:00Added an answer on May 20, 2026 at 10:20 am

    You didn’t post the exact definition of your classes but you are currently doing a cartesian product in your Linq query – you are creating every possible combination whereas you really only want “matching” combinations (since a trading day in your schema for some reason seems to be associated with a symbol). What you should do instead is a join, something like:

      from TradingDay t in db4o.db
      join Symbol s in db4o.db
      on s.SymbolGlobal equals t.SymbolGlobal 
      where (s.SymbolGlobal == "IBM" 
             && t.Date == new DateTime(2010, 10, 19))
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have run into a bit of a tricky problem in some C++ code,
Just run into a tricky NSFetchedResultsController problem. The following code works fine in all
I often run into the following problem. I work on some changes to a
I've run into a problem where I make changes to a few JavaScript files
I've run into a problem where I'm getting two printouts of my /etc/motd file
I have run into the problem where my css files are being cached in
I’ve run into a problem while upgrading Azure SDK from version 1.2 to 1.3.
I run into what seems to be a very classical problem: An item and
I have run into an interesting problem which I'm pretty sure is the fault
I've run into a very strange problem in Eclipse, and I'm not sure if

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.