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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:17:14+00:00 2026-05-15T17:17:14+00:00

I am having a strange problem. But first the orm.xml: <entity class=de.test.businessobjects.Repeat> <table name=repeat/>

  • 0

I am having a strange problem. But first the orm.xml:

<entity class="de.test.businessobjects.Repeat">
    <table name="repeat"/>
    <attributes>
        <id name="id">
            <generated-value strategy="TABLE"/>
        </id>
        <many-to-one name="repeatType" fetch="LAZY">
            <join-column name="id_repeatType"/>
        </many-to-one>
        <many-to-one name="trainingSet" fetch="LAZY">
            <join-column name="id_trainingSet"/>
        </many-to-one>
    </attributes>
</entity>

I use Hibernate / JPA. Everything runs fine with HSQL and Derby, so my BO, DAO and unit tests must be ok. When testing with MySQL, I get this error:

org.springframework.dao.InvalidDataAccessResourceUsageException:
could not execute query; SQL [select
repeat0_.id as id8_,
repeat0_.id_repeatType as id2_8_,
repeat0_.id_trainingSet as id3_8_ from
repeat repeat0_];

However, changing

<table name="repeat"/>

to

<table name="repeatt"/>

solves the problem with MySQL.

What is wrong? Is “repeat” a reserved keyword or is this a bug in Hibernate’s JPA implementation?

Thank & Cheers
Er

  • 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-15T17:17:15+00:00Added an answer on May 15, 2026 at 5:17 pm

    The SQL Reserved Words Checker tells me that “repeat” is a reserved SQL keyword with MySQL (and DB2) so you need to escape it.

    JPA 1.0 doesn’t define a standard way to handle that so you’ll have to use Hibernate solution which relies on backticks. From the Hibernate Reference Guide:

    5.4. SQL quoted identifiers

    You can force Hibernate to quote an
    identifier in the generated SQL by
    enclosing the table or column name in
    backticks in the mapping document.
    Hibernate will use the correct
    quotation style for the SQL Dialect.
    This is usually double quotes, but the
    SQL Server uses brackets and MySQL
    uses backticks.

    <class name="LineItem" table="`Line Item`">
        <id name="id" column="`Item Id`"/><generator class="assigned"/></id>
        <property name="itemNumber" column="`Item #`"/>
        ...
    </class>
    

    I assume this would work in orm.xml too.

    JPA 2.0 went further and defined a way to specify delimited identifiers:

    2.13 Naming of Database Objects

    …

    To specify delimited identifiers, one of the following approaches must be used:

    • It is possible to specify that all database identifiers in use for a persistence unit be treated as delimited identifiers by specifying the <delimited-identifiers/> element within the persistence-unit-defaults element of the object/relational xml mapping file. If the <delimited-identifiers/> element is specified, it cannot be overridden.
    • It is possible to specify on a per-name basis that a name for a database object is to be interpreted as a delimited identifier as follows:
      • Using annotations, a name is specified as a delimited identifier by enclosing the name
        within double quotes, whereby the inner quotes are escaped, e.g., @Table(name="\"customer\"").
      • When using XML, a name is specified as a delimited identifier by use of double
        quotes, e.g., <table name="&quot;customer&quot;"/>

    If you are using JPA 2.0, I’d recommend to use the portable solution.

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

Sidebar

Related Questions

I've been having a very strange problem. I have a test class that subclasses
I'm having a strange problem with unit test in grails, when I try to
I'm having a strange problem with the HTML5 manifest file under Chrome 5.0.375.99 but
I am having a problem that is strange to me but hopefully is not
I'm having a strange problem. I want to put border around the image, but
I've been having a strange problem with table cells that I've never seen before.
I am having a strange problem with the .NET TabControl in C# (Visual Studio
I'm having a strange problem with ZeroMQ, in which some messages get stuck, and
I'm having a strange problem with IIS, asp.net and ODBC. My application is driven
We are having a strange problem with the Appfabric DataCache. Sometimes, 1 in 1000

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.