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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:55:48+00:00 2026-05-24T04:55:48+00:00

I am trying to join two EJB’s using EJBQL (with an underlying MySQL data

  • 0

I am trying to join two EJB’s using EJBQL (with an underlying MySQL data source). The two tables in question are

Machine
  - Hostname
  - ... unrelated fields ...

and

Location
 - Code
 - Human readable description

The tables should be LEFT joined on the location code and the first three characters of the machine’s hostname. In straight up MySQL the command is:

SELECT * FROM machine m LEFT JOIN location l ON (SUBSTRING(m.`Name`, 1,3) = l.`Code`);

When I put a similar thing into EJBQL I get all sorts of errors raning from null poninter exceptions to invalid syntax exceptions — here’s what I have tried:

query="SELECT NEW someObj(m, loc) FROM Machine as m " +
      "LEFT JOIN FETCH Location as loc " +
      "WHERE (SUBSTRING(m.hostname, 1, :length) = loc.code)"

I’ve also tried using “ON” instead of “WHERE” — but EJBQL comes back with an unexpected keyword when I use ON…

So — has anyone succeeded in doing something like this before? The documentation for EJBQL seems to indicate that LEFT join is OK, so I’m not sure what the deal is…

Thanks


Edit: The exception I am getting is:

outer or full join must be followed by path expression — it was buried in the same line as the null pointer deal

Edit 2:

There is no relation between a Machine and a Location, unfortunately I cannot change that

  • 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-24T04:55:48+00:00Added an answer on May 24, 2026 at 4:55 am

    If there is no relation between the two, and if you really only need the Machineobject, what you can do is change the LEFT JOIN FETCH to an IN statement, as in (pseudo-code):

    select from Machine m 
    where (SUBSTRING(m.hostname, 1, :length) in (some kind of logic about Location)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to perform a join on two tables in MySQL, and the
I am trying to join two tables; the purpose being able to search and
I'm trying to LEFT JOIN two tables, to get a list of all rows
Using extension syntax I'm trying to create a left-join using LINQ on two lists
I am using Access 2007 to create an SQL query to join two tables.
really struggling to resolve this issue. using nhibernate Im trying to join two different
I am trying to join two tables. One being the sys.databases table and the
I am trying to perform a simple join on two tables and am having
I'm trying to join two relatively simple tables together, but my query is experiencing
I am trying to join these two tables I created so that the resultset

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.