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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:22:49+00:00 2026-05-27T07:22:49+00:00

This link shows how a unidirectional ManyToOne can be joined from the other side

  • 0

This link shows how a unidirectional ManyToOne can be joined “from the other side” of association.
Does this also work for OneToOne associations?

In my case, I have StateTransitionEvent entity that has a unidirectional one-to-one association with OrderStateEntity. I don’t want to make the relationship bidirectional on the object level, the OrderState class doesn’t need to know about the transitions.

@Entity
class StateTransitionEvent {
    @OneToOne
    private Order transitionFrom;

    @OneToOne
    private Order transTo;
}

@Entity
class OrderState {
   // no association to StateTransitionEvent
} 

Since Order has many unidirectional relationships, it would like to start the query from the Order entity, but I need to join the Order with the StateTransitionEvent.
The query would look something like:

SELECT e FROM Order o JOIN stateTranstionEvent.transitionFrom tf…

Is that possible, or do I have to make the association bidirectional on the object level?

  • 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-27T07:22:49+00:00Added an answer on May 27, 2026 at 7:22 am

    Your question is not very clear. What is e, in SELECT e FROM Order o JOIN stateTranstionEvent.transitionFrom tf?

    You can’t join from Order to StateTransitionEvent (since there is no association from Order to StateTransitionEvent). But you can join in the other direction, and you may select the order or the event:

    select e from StateTransitionEvent e join e.transitionFrom tf 
    where e.foo = :foo and tf.bar = :bar
    

    or

    select tf from StateTransitionEvent e join e.transitionFrom tf 
    where e.foo = :foo and tf.bar = :bar
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this link shows How to prevent Custom Views from losing state across screen orientation
I found this link. Very cool. That shows how you can store appsettings in
ScottGu in this post link text shows how one can utilize EditorTemplates for things
This link shows a video where an app upgrade is forced from within the
This link shows you that jQuery uses (new Function(return + data))(); for older browsers,
This link http://ajaxcontroltoolkit.codeplex.com/releases/view/11121#DownloadId=28808 shows a popup on which one has to agree before being
I have this line below that shows a link to go the next page
how to show specific tab with link from another page <a href=index.php?page=home#tab2>Home</a> this is
following this link i was able to load and read pixels from a .gif.
Someone please see my code at this link for input taken from 2.2 mb

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.