How do you handle the situation where persistence class attribute name is one of the reserved keyword in database; e.g. user ? Will this cause any issue while hibenrate executes SQL statements behind the scene?

Questions by sunils   answers by sunils

Showing Answers 1 - 4 of 4 Answers

Prashant

  • Dec 29th, 2006
 

you should not declare java keywords as attribute name .because when u execute the code it will search for getter /setter method.which can not be created in java files(reserved keywords);

  Was this answer useful?  Yes

Hari Singh

  • Feb 21st, 2007
 

It will not create any problem hibernate will take care of it. In table columns if table can be created with that attribute name then it can be use in hibernate also.

Prashant ,
The question is not java reserved key word. Pls read the questions carefully b'fore replying

  Was this answer useful?  Yes

Sony V George

  • Apr 4th, 2007
 

It doesnt make any problem, Through hsql u can perform the query. If it is resrved key word also, hibernate will take care of it.

  Was this answer useful?  Yes

Alok Kushwah

  • Jul 22nd, 2007
 

In case attribute name in a class is keyword in underlying database, attribute should be mapped with some other column name that is acceptable for DB. For instatce a class can have attribute "date" (getDate()/setDate()) and in most of DB, date is reserve keyword for "Date" datatype. So we can map this with some other column name

<property name="date" column="blah_date"  type="date" />


Otherwise mapping won't work.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions