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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:11:11+00:00 2026-06-02T01:11:11+00:00

We have an entity column with a formula property that requires today’s date at

  • 0

We have an entity column with a formula property that requires today’s date at midnight in order to calculate itself property:

DATEADD(DD, DATEDIFF(DD, 0, GETDATE()), 0)

Hibernate transforms this into:

DATEADD(mytablename0_.DD, DATEDIFF(mytablename0_.DD, 0, GETDATE()), 0)

I’ve double checked that my dialect is SqlServer. I’ve also replaced DD with DAY, but the problem remains.

How do I get hibernate to recognize that DD is a keyword?

  • 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-02T01:11:13+00:00Added an answer on June 2, 2026 at 1:11 am

    I had the same issue when upgrading from Sybase to SQLServer. The field in my scenario was an integer field used to store a date since 1970-01-01. The DATEADD function was used to convert that integer into a genuine date so we had a good representation through the hibernate mapped objects.

    My original mapping for this field was the following:

    <property name="lostDate" type="date">
      <formula>dateadd(dd, lost_date, '01-JAN-1970')</formula>
    </property>
    

    This resulted in the problem that you described in the question, where the resulting sql passed to the database was:

    dateadd( table0_.dd, table0_.lost_date, '01-JAN-1970')
    

    Updating the mapping to surround the dateadd keyword dd in double quotes resolved this issue for me.

    <property name="lostDate" type="date">
      <formula>dateadd("dd", lost_date, '01-JAN-1970')</formula>
    </property>
    

    SQL Server 2008 accepted the generated SQL below and executed as expected.

    dateadd("dd", table0_.lost_date, '01-JAN-1970')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an entity class that has a property with an underlying db column
I have an abstract entity called Block which contains two attributes: column and order
I have an entity with a binary column that's set to lazy load in
I have an entity named 'account' which will have a username column and I
I have the following entities: @Entity public class Owner{ @Id @Column(name = OWNER_ID) @OneToMany()
In my business model I have Entity class (IPoint interface ) that has a
I have an entity which has an ID field: @Id @Column(name = `U##ID_VOIE`) @GeneratedValue(generator
I have a column in a table in which we are storing date in
In entity framework I have an Entity 'Client' that was generated from a database.
Is their a way using Entity Framework Code-Only to have an entity that has

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.