I have used in my java DAO class which contains Space in between LANG PREF
@Column(name = "LANG PREF")
private String langprefid;
Once my java class runs, I am getting
org.hibernate.exception.SQLGrammarException: Incorrect syntax near the keyword 'as'.
Can anyone help me regarding this problem?
If you're using Hibernate native API, then you can escape them using backticks:
@Column(name = "`LANG PREF`")
If you are using JPA, you can escape with double quotes:
@Column(name = "\"LANG PREF\"")
If you want to automatically scape reserved keywords, you can set to true
the Hibernate-specific hibernate.globally_quoted_identifiers
configuration property:
<property
name="hibernate.globally_quoted_identifiers"
value=true"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With