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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:49:50+00:00 2026-06-08T17:49:50+00:00

Is there any convention how to name parameters in JPQL ?Because today after some

  • 0

Is there any convention how to name parameters in JPQL?Because today after some debugging I realized that I can’t put inside name for example colon.

Also I discovered second problem, from some reason I can’t use use constants as parameter names. I will always get a

org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:466)

Here is my code

@NamedQueries({
    @NamedQuery(
        name=Lookup.GET_LOOKUP_DATA_QUERY, 
        query="SELECT t.textShort, lookup.metaCode, lookup.tableName FROM Lookup lookup, Txt t" +
                " WHERE (lookup.metaCode = t.txtHeadCode OR t.txtHeadCode IS NULL) AND lookup.module.id =:" + Lookup.PARAM_MODULE_ID +
                " AND lookup.metaCode IN (:" + Lookup.PARAM_LOOKUP_META_CODES + ") AND t.lang.metaCode = 'lang_cz'")
})

@Entity
@Table(name = "TABLE")
public class Lookup {

private static final long serialVersionUID = 1L;

public static final String GET_LOOKUP_DATA_QUERY = "Lookup.GetLookupDataQuery";
public static final String PARAM_MODULE_ID = "Lookup.PARAM_MODULE_ID";
public static final String PARAM_LOOKUP_META_CODES = "Lookup.PARAM_LOOKUP_META_CODES";

@Id
@Column(name ="META_CODE")
private String metaCode;

@Column(name = "ID")
private Long id;

@ManyToOne
@JoinColumn(name="MODULE_ID")
private Module module;
}

+ getters, setters and other properties

Provider is Hibernate but query is written in pure JPA

So does anyone know how to solve this?

  • 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-08T17:49:51+00:00Added an answer on June 8, 2026 at 5:49 pm

    You cannot use characters that are not part of valid identifier as defined by Character.isJavaIdentifierPart. named parameters are defined in JPA 2.0 specification:

    A named parameter of a Java Persistence query language query is an
    identifier that is prefixed by the “:” symbol. The parameter names
    passed to the setParameter methods of the Query and TypedQuery
    interfaces do not include this “:” prefix.
    …
    An identifier is a character sequence of unlimited length. The
    character sequence must begin with a Java identifier start character,
    and all other characters must be Java identifier part characters. An
    identifier start character is any character for which the method
    Character.isJavaIdentifierStart returns true. This includes the
    underscore (_) character and the dollar sign ($) character. An
    identifier part character is any character for which the method
    Character.isJavaIdentifierPart returns true. The question mark (?)
    character is reserved for use by the Java Persistence query language.

    Using constants when query string for @NamedQuery is built does not cause problems. It is compile time construct and Hibernate is not aware of was this query built with constants or not.

    In your current query all named parameters are invalid. That is because of ‘.’. According Character.isJavaIdentifierPart it is not one of the valid characters.

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

Sidebar

Related Questions

I have many js files, with some naming convention. If there any tool that
Is there any official/unofficial/informal convention for alt+key namings ? maybe, Microsoft have some internal
Is there any way to create a naming convention for my primary key constraints
Other than convention, is there any reason to use or not to use local
Is there a Java convention to refer to methods, static and otherwise, any specific
Are there any standalone type conversion libraries? I have a data storage system that
Is there any reason why I should close the connection after a query or
Is there any c# library that handles lossless conversion between different image formats?
Is there any tidy way to keep the same thread name when making an
Is there any kind of naming convention for C# WinForms code? I Googled this

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.