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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:52:47+00:00 2026-06-15T15:52:47+00:00

My Entity class @Entity class MasterStccycode{ private static final long serialVersionUID = 1L; @Id

  • 0

My Entity class

@Entity
class MasterStccycode{
   private static final long serialVersionUID = 1L;
   @Id
   @Basic(optional = false)
   @NotNull
   @Size(min = 1, max = 3)
   @Column(name = "CODE")
   private String code;

   @Size(max = 100)
   @Column(name = "DESC")
   private String desc;
}

my JPA Query
SELECT t.code, t.desc FROM MasterStccycode t

then I have this following exception

Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException

Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword ‘DESC’.

Error Code: 156

Call: SELECT CODE, DESC FROM master_stccycode
Query: ReportQuery(referenceClass=MasterStccycode sql=”SELECT CODE, DESC FROM master_stccycode”)

I know the solution is to wrap the DESC keyword with [] into [DESC] but how can I do this on JPA QL?

  • 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-15T15:52:48+00:00Added an answer on June 15, 2026 at 3:52 pm

    DESC is a reserved word on most databases. You should rename the field.

    You could also quote the field, but just renaming it would be best.

    @Column(name = "\"DESC\"")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ENTITY CLASS : public class MyUser implements Serializable { private static final long serialVersionUID
Entity: @Entity @Table(name=user_account) public class UserAccount implements Serializable{ private static final long serialVersionUID =
Example: @Entity class Table_A{ @Id @generatedValue private long ID; @Column private String name; @Transient
Consider this class: @Entity class Bar { @Id private long id; private FooId fooId;
mI've this entity class: @Entity public class User implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private
If I have this entity: @Entity class Pet { @Id long id; public enum
Here is my Entity Class public enum UnitType { HOSPITAL, HEALTHCENTER } public static
@Entity class Host { private String Model; private String OS; @Column (name=OS) public String
I have an entity class: Cabbage.java package womble; public class Cabbage { private int
Suppose I have an entity class that stores a username: class Profile { private

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.