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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:32:35+00:00 2026-06-09T13:32:35+00:00

I have written a code which has Suite information with Test case information embedded

  • 0

I have written a code which has Suite information with Test case information embedded inside it.I have written the TestCase.java and Suite.java and they seem to have no errors.But with the MongoMapper.java which I have written I am getting this error.
The method fromDBObject(Class, BasicDBObject) in the type Morphia is not applicable for the arguments (Class, DBObject).Kindly help me with this as well as suggest me how to see whether I have my collections updated in the MongoDB Shell.Thanks in advance.Here is my code.

package com.DrAssist.Morphia.model;
import com.google.code.morphia.Morphia;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.Mongo;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.net.UnknownHostException;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;

public class MongoMapper {
    Morphia morph;
    Mongo mongo;
    DBCollection DrAssistReport;
    @Before
    public void setUp() throws UnknownHostException {
    morph = new Morphia();
    mongo = new Mongo("127.0.0.1", 27017);
    // This is where we map Persons and addresses
    // But shouldn't the annotation be able to handle that?
    morph.map(Suite.class).map(TestCase.class);
    DB testDb = mongo.getDB( "test" );
    DrAssistReport = testDb.getCollection("DrAssistReport");
    }

    @Test
    public void storePersonThroughMorphiaMapping () {

    Suite suite = new Suite(new TestCase("1",new String[]{"Test1", "Test2", "Test3", "Test4"},"1","5","6","7","889"));
    suite.setSID("1");
    suite.setsuiteName("Suite1");
    suite.setnoOfTests("5");


    DrAssistReport.save(morph.toDBObject(suite));
    Suite suite2 = morph.fromDBObject(Suite.class, DrAssistReport.findOne());
    assertNotNull(suite2.getSID());



    }
}

The ERROR I am getting is The method fromDBObject(Class, BasicDBObject) in the type Morphia is not applicable for the arguments (Class, DBObject)

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

    It looks like you’re using a version of Morphia from before this change: http://code.google.com/p/morphia/issues/detail?id=15

    You could try either casting the return value from DrAssistReport.findOne() to a “BasicDBObject” or upgrade the verison of Morphia that you’re using to a version whose Morphia.fromDBObject method takes a DBObject rather then requiring a BasicDBObject.

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

Sidebar

Related Questions

I have written PHP code which connects to MYSQL to look up information, sends
Let's assume I have a framework written in Java and some C++ code which
Hi I work with netbeans. I have written a code which has two classes
I have written a code in java. In which I have created a package
I have written a code which has 2 parts to it. The first one
I have written the below code which has a text-field and a button. as
I have written a code which does the thing as the title says. The
I have written a code in which i want to open a HTM file
Need assistance with the pexpect module I have written a simple code which would
I have written two pieces of code which I intended to have identical outputs,

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.