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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:30:15+00:00 2026-06-12T07:30:15+00:00

I have a Node which is associated with NodeData s. These NodeData s have

  • 0

I have a Node which is associated with NodeDatas. These NodeDatas have revisions, and Node has a column latestRevision which tells it which is the last revision.

I’m trying to figure out the mapping I need to get the set below filtered by the latestRevision in Node.

 <class name="Node" table="RatNodes">
    <id name="id">
        <generator class="native"/>
    </id>
    <set fetch="join" name="nodeDatas" table="RatNodeData" inverse="true" access="field" cascade="all-delete-orphan" order-by="dataOrder asc">
        <key column="nodeID" on-delete="cascade"/>
        <one-to-many class="NodeData"/>
        <filter name="revisionFilter" condition="revision = latestRevision"/>
    </set>
    <property name="questionNumber" access="field"/>
    <property name="type" access="field"/>
</class>
<class name="NodeData" table="RatNodeData">
    <composite-id>
        <key-property name="nodeID" access="field"/>
        <key-property name="key" access="field" column="dataKey"/>
        <key-property name="order" access="field" column="dataOrder"/>
        <key-property name="revision" access="field"/>
    </composite-id>
    <property name="value" access="field" type="EncodedStringUserType" column="dataValue"/>
</class>

The result of this mapping when I enable the filter is an error:

Caused by: com.jnetdirect.jsql.JSQLException: Invalid column name 'latestRevision'.

The query it spits out is:

select nodedatas0_.nodeID as nodeID1_, nodedatas0_.dataKey as dataKey1_, nodedatas0_.dataOrder as dataOrder1_, nodedatas0_.revision as revision1_, nodedatas0_.nodeID as nodeID46_0_, nodedatas0_.dataKey as dataKey46_0_, nodedatas0_.dataOrder as dataOrder46_0_, nodedatas0_.revision as revision46_0_, nodedatas0_.dataValue as dataValue46_0_ from RatNodeData nodedatas0_ where  nodedatas0_.revision = nodedatas0_.latestRevision and nodedatas0_.nodeID=? order by nodedatas0_.dataOrder asc

I can tell this is wrong as it’s looking for latestRevision on NodeData but I’m not sure how to tell it to look on Node instead. Is this possible in hibernate? Seems like a pretty simple query if I were just using SQL.

  • 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-12T07:30:17+00:00Added an answer on June 12, 2026 at 7:30 am

    Ended up doing this instead of trying to do it in the mapping file:

    List datas = session.createCriteria(NodeData.class)
                    .add(Restrictions.eq("nodeID", this.id))
                    .add(Restrictions.eq("revision", this.latestRevision))
                    .list();
    

    I’m not sure if this is the right way to do this or not. Would love to hear about a mapping file solution too.

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

Sidebar

Related Questions

I have a table which contains data about which node has been visited. It
I have a very simple node.js app built on express which has been handling
I have a XML file which has a node which is commented out. I
In the sitemap file, I have sitemap Node URL which have more than 1
I have the following node(s) which I retrieve in a streamreader. There could be
I have a base and derived class called Node which form elements of a
I have following xml and I want to fetch the value of node which
Hi I have a node events and have 6 types 'eventItem' which are children.
i have this hap code of which tries to selects sub-node from the main
I have this method which leaks ~ 6KB : + (EInspectorFacilityInfo*) newWithNode: (CXMLNode*) node

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.