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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:04:14+00:00 2026-06-07T16:04:14+00:00

I have 3 tables with the following structure. User uid username password Friend id

  • 0

I have 3 tables with the following structure.

User

uid
username
password

Friend

id
uid
fid

Post

pid
uid
msg

I want to find all the posts that the friends of a user did. In SQL I extract that using this statement:

SELECT post.* FROM Post 
INNER JOIN Friend f ON f.fid = post.uid 
INNER JOIN User u ON f.uid = u.uid
WHERE u.uid = 1;

How can I convert this to JPQL?

  • 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-07T16:04:16+00:00Added an answer on June 7, 2026 at 4:04 pm

    JPQL queries entities and their associations, and you haven’t described them, so it’s a bit hard to say. But assuming a Post has a ManyToOne with a Friend, and a Friend has a ManyToMany with a User, the query would be:

    select post from Post post
    inner join post.friend friend
    inner join friend.users user
    where user.uid = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with following structure Whenever user click on checkbook and click on
I have an asp:table(table1), in a user control with following structure | Col2 |
I have 2 tables Test1 and Test1Update with following structure Test1 id name address
I have two database tables with the following structure: actions: action_id int(11) primary key
We have the following structure: ReportsDatabase X Report Y Report Y uses several tables
I have following table structure. I want to select distinct user_id according to office_id
Suppose I have the following tables: User, Computer and Command. Users and computers may
Say I have three tables: User Table { UserId INT, Username NVARCHAR ... }
I have 2 SQL Server tables with the following structure Turns-time cod_turn (PrimaryKey) time
I have the following table structure: ID, User_ID, DateTime Which stores a user 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.