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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:06:45+00:00 2026-05-14T04:06:45+00:00

I have the following mapping for my table in MySql: <class name=Tag, namespace table=tags

  • 0

I have the following mapping for my table in MySql:

<class name="Tag, namespace" table="tags" >
 <id name="id" type="Int32" unsaved-value="0">
   <generator class="native"></generator>
 </id>
 <property name="name" type="String" not-null="true"></property>
 <component name="record_dates" class="DateMetaData, namespace" >
   <property name="created_at" type="DateTime" not-null="true"></property>
   <property name="updated_at" type="DateTime" not-null="true"></property>
 </component>
</class>

As you see the record_dates property is defined as a component field of type DateMetaDate. Both created_at and updated_at fields in ‘tags’ table are updated via triggers. Thus I can insert a new record like such:

var newTag = new Tag() 
{ 
 name = "some string here"
}

Int32 id = (Int32)Session.Save(tag);
Session.Flush();

ITag t = Session.Get<Tag>(id);
ViewData["xxx"] = t.name; // -----> not null
ViewData["xxx"] = t.record_dates.created_at; // -----> is null

However when querying the same record back immediately after it was inserted the record_dates field ends up null even though in the table those fields have got values.

Can any one please point out why the Session.Get ignores getting everything back from the table? is it because it caches the newly created record for which the records_dates is null? If so how can it be told to ignore the cached version?

  • 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-14T04:06:46+00:00Added an answer on May 14, 2026 at 4:06 am

    Try using lazy=”false” in your class tag:

    <class name="Tag, namespace" table="tags" lazy="false">
    

    As per my knowledge, the default behavior is to have lazy loading, which might not refresh your objects as needed.

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

Sidebar

Related Questions

I have following mapping definitions: <class name=Role table=Role optimistic-lock=version > <id name=Id type=Int32 unsaved-value=0
i have the following hibernate mapping: <class name=Domain.Roomreservation, Core table=Reservationroom> <id name=ID unsaved-value=undefined> <generator
I have the following mapping: <hibernate-mapping package=server.modules.stats.data> <class name=User table=user> <id name=id> <generator class=native></generator>
I have the following mapping: @Entity @Table(name = Prequalifications) public class Prequalification implements Serializable
Lets say I have the following mapping: <hibernate-mapping package=mypackage> <class name=User table=user> <id name=id
I have a MySQL tag-mapping table with structure from the following post - Recommended
I have the following code in my context, and no explicit table-class mapping, yet
I have the following mapping @Entity @SequenceGenerator(name=sacpSequenceGenerator, sequenceName=SACP_SEQ) public class Sacp { private Integer
I have a hibernate mapping as follows: <hibernate-mapping> <class name=kochman.elie.data.types.InvoiceTVO table=INVOICE> <id name=id column=ID>
Consider the following Hibernate mapping file: <hibernate-mapping ...> <class name=ContentPackage table=contentPackages> <id name=Id column=id

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.