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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:42:40+00:00 2026-05-19T00:42:40+00:00

i am trying to load a hibernate object ForumMessage but in it contain another

  • 0

i am trying to load a hibernate object ForumMessage but in it contain another object Users and the Users object is not being loaded.

My ForumMessage Mapping File:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jan 4, 2011 10:10:29 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="com.BiddingSystem.Models.ForumMessage" table="FORUMMESSAGE">
        <id name="ForumMessageId" type="long">
            <column name="FORUMMESSAGEID" />
            <generator class="native" />
        </id>
        <property name="ForumMessage" type="java.lang.String">
            <column name="FORUMMESSAGE" />
        </property>
        <many-to-one name="User" class="com.BiddingSystem.Models.Users" fetch="join">
            <column name="UserId" />
        </many-to-one>
        <property name="DatePosted" type="java.util.Date">
            <column name="DATEPOSTED" />
        </property>
        <many-to-one name="Topic" class="com.BiddingSystem.Models.ForumTopic" fetch="join">
            <column name="TopicId" /> 
        </many-to-one>
    </class>
</hibernate-mapping>

and I am using the follwing code:

Session session = gileadHibernateUtil.getSessionFactory().openSession();

            SQL="from ForumMessage";


    System.out.println(SQL);
    Query query=session.createQuery(SQL);
    System.out.println(query.list().size());
    return new LinkedList <ForumMessage>(query.list());
  • 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-19T00:42:40+00:00Added an answer on May 19, 2026 at 12:42 am
    <many-to-one name="User" class="com.BiddingSystem.Models.Users" fetch="join" lazy="false">
    

    You need to add lazy=”false” as well.

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

Sidebar

Related Questions

I am trying to load a very basic XML document but everytime I get
I'm trying to load Gravatars into Flash. Luckily, they provided a crossdomain.xml file at
While trying to load a Bitmap onto a SWFLoader the Event.COMPLETE event is not
I have a requirement to load a complex object called Node ...well its not
How do I get Spring to load Hibernate's properties from hibernate.cfg.xml ? We're using
I am trying to make hibernate load my whole tree with no success. I
I am using Jboss5 and I'm trying to utilize Hibernate and Spring to load
I am trying to configure Spring3 + JPA using Hibernate, but I am getting
I've got a problem with NHibernate trying to load a small hierarchy of data.
i m trying load UIImages from server asynchronously in UITableViewCell. My code worked fine

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.