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

  • Home
  • SEARCH
  • 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 8341005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:20:30+00:00 2026-06-09T05:20:30+00:00

I have several objects classes mapped to a database using annotations and need some

  • 0

I have several objects classes mapped to a database using annotations and need some help working out how to put together a Hibernate query to get the results I want.

I’m using Hibernate 3.6.5. I’ve been using Criteria, but happy with Query etc if it works!

I’m new to Hibernate (can manage simple Criteria to filter objects by property but the join stuff is all new), so any explanation in the answer (or suggested reading) would be great.

A RawRead has a tagcode field which contains a String.
Checkpoint, IncidentItem and Guard classes all also have a TagCode property.

I want to retrieve all RawRead objects where the TagCode doesn’t match any tagcode value from any of the other classes (IncidentItem, Guard, Checkpoint).

A sort of brain dump/psuedo SQL code:

select raw.* from 
    RAWREADS raw, checkpoints c, GUARDS g, INCIDENTITEMS i 
    where 
    raw.tagcode != c.TAGNO
    and raw.TAGCODE != g.IDTAG
    and raw.TAGCODE != i.IDTAG;

I realise that won’t be efficient etc, just an illustration of my thoughts.

Can you suggest what to look at in Hibernate language?

EDIT/Additions:
The RawRead object is mapped to Guard and Checkpoint (has a property called checkpoint and one called guard that are both instances of those classes – both are @ManyToOne).

IncidentItem does not have any mapping to the other classes.

  • 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-09T05:20:31+00:00Added an answer on June 9, 2026 at 5:20 am

    In order to join objects in HQL there has to be a relationship mapped between them in the annotations at the application level. If there are no mapped relationships, you’ll need to do a query like this in plain SQL.

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

Sidebar

Related Questions

I already have a working android app with several persisted objects/classes. But what if
I have several objects in my app that can become nil at some point
I have to serialize several objects inheriting from WebControl for database storage. These include
I am writing some PHP. I have several classes that do not declare any
Sometimes we have several classes that have some methods with the same signature, but
Well, I have developed a java application using several objects relationships that make the
I have several objects of different kinds (different function names, different signatures) and I
I have several objects like this: I want to move type and value one
I have several objects set up in Core Data, one of which is Deck
I have users that have several objects and can upload images for those objects.

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.