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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:46:39+00:00 2026-05-30T19:46:39+00:00

Say that I want to do a select from 2 databases. Database1 has fields

  • 0

Say that I want to do a select from 2 databases. Database1 has fields A, B and C. Database2 has fields D, E and F. I have a POJO that consists of fields X, Y and Z. I want to write a CriteriaBuilder query to select all of the B, D and F fields in the result set and map them to the fields X, Y and Z in my POJO, returning a list of my POJO objects. Is this possible? I can do this with a native query, but I don’t want to use native queries.

  • 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-30T19:46:40+00:00Added an answer on May 30, 2026 at 7:46 pm

    You can try using the below query to return a entity initialized by other entities :

    SELECT NEW com.package.Entity3(e1.b, e2.d, e2.f) FROM Entity e1, Entity e2;
    

    Then you have to provide a constructor with similar signature as in query, where you can set the field values as required.

    public Entity3(int b, int d, int f){
       x = b;
       y = d;
       z = f;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I want to have a table that logs the date and
Let's say that I want to merge from a release branch to the master
Lets say that I have an executable and when it is started I want
Let's say that I have an application frame, and I want to show a
I'm trying to write a query in php that will select a row from
first i want to say that this site has been a really big help
Let's say that you want to create a dead simple BlogEditor and, one of
For Example: Let's say that I want to return a view that displays a
I am using NERD commenter Let's say that I want to comment out lines
My simplified and contrived example is the following:- Lets say that I want to

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.