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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:59:39+00:00 2026-05-26T00:59:39+00:00

I have this query be used on hibernate with java: String hql = select

  • 0

I have this query be used on hibernate with java:

String hql = "select part.ID,part.PartNumber,part.Name,parttype.Name,partkind.Name,
                      partdevice.Name,part.Count,STUFF((SELECT ', ' + cabinet.Name FROM Cabinet as 
                      cabinet,Part_Cabinet as part_cabinet WHERE part.ID=part_cabinet.PaId and cabinet.ID =
                      part_cabinet.CabId FOR XML PATH('')),  1, 1, ''),part.Descript from Part as part,
                      PartDevice as partdevice,PartKind as partkind,PartType as parttype Where
                      part.Kind=partkind.ID and part.Type=parttype.ID and part.Device=partdevice.ID";
Query _q = session.createQuery(hql);

But I get an error:

unexpected token: FOR
    at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3473)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3168)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3040)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2750)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:568)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2518)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2474)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2343)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2269)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2224)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2010)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1786)

Why?

  • 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-26T00:59:39+00:00Added an answer on May 26, 2026 at 12:59 am

    The problematic part of the query is:

    WHERE part.ID=part_cabinet.PaId
    AND cabinet.ID = part_cabinet.CabId
    FOR XML PATH('')
    

    FOR XML PATH is a MSSQL 2005 feature absent in Hibernate. HQL is not a superset of SQL, and certainly it can’t access database specific features.

    You should probably use native query for this use case as it allows you to query the database directly using SQL via Hibernate APIs.

    And please link when multiposting questions.

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

Sidebar

Related Questions

I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I have this query: SELECT page.id, revision.title, revision.number FROM page INNER JOIN revision ON
I have this query: (SELECT e.IdEvent,e.EventName,e.EventSubtitle,e.EventDescription,l.LocationName,e.EventVenue,EventStartDate,e.EventEndDate,e.EventHost,c.CategoryName,l.LocationCity,l.LocationState,e.isTBA, (SELECT s.status FROM jos_rsevents_subscriptions s WHERE s.IdUser =
I have this query: SELECT p.id, r.status, r.title FROM page AS p INNER JOIN
I have this elementary query: SELECT d.description, o.code FROM order_positions AS o LEFT JOIN
I have a stored procedure that consists of a single select query used to
The situation is this: a table that is used in a query (name it
I have this query statement and want to only get records that has a
I have this query in LINQ to Entities. var query = (from s in
I have this query this.FixturePartidoPuntaje.Load(); var partidos = from q in this.FixturePartidoPuntaje where (

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.