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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:31:25+00:00 2026-06-17T05:31:25+00:00

I got two class, one reference another by using @Reference When inserting I will

  • 0

I got two class, one reference another by using @Reference
When inserting I will insert the referenced one first and insert the object with the reference field later.
Everything works fine when I fetch them in the most of time.But sometimes, I got exceptions like

SEVERE: java.lang.RuntimeException:
com.google.code.morphia.mapping.MappingException: The reference({
“$ref” : “UserContactLink”, “$id” : “50e92481cde5dadc12ff854b” })
could not be fetched for net.shisoft.db.obj.UserContact.ucs

When I checked the id in UserContactLink and there is no such document with this id. I think this is because I terminate the progress of mongod last time and the transaction (in my viewpoint) didn’t finished and the data relation has been corrupted.
Seems mongodb don’t have transaction feature, what can I do with this issue?

  • 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-17T05:31:26+00:00Added an answer on June 17, 2026 at 5:31 am
    1. There are no transactions. In many cases you can restructure your documents to avoid problems with that (embedding documents,…)

    2. You will always need to insert the referenced document first. Upon insert, the MongoDB server creates the ObjectId of the entity which is then used in the reference. You might want to check for the ID before you reference (simple check for null).

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

Sidebar

Related Questions

I have got two models, seen below, and am trying to insert one of
Currently ive got some reference counted classes using the following: class RefCounted { public:
I am making chat app with publisher and subscriber I got two class one
I've got two classes; one for my window and one for my controlling object
I've got two models: class Solution < ActiveRecord::Base belongs_to :owner, :class_name => User, :foreign_key
If I've got two properties in a class with the same interface type and
I've got two theoretical domain objects: public class Person { public virtual int Id
I've got two List<Name> s: public class Name { public string NameText {get;set;} public
I've got a two classes (pupil, class) in a Roo-project and their scaffolded views.
I've got a class representing an interval. This class has two properties start and

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.