Mapping a table called “group” in Hibernate for DB2 and HSQLDB

柔情痞子 提交于 2019-12-05 20:52:52

I ended up doing create alias groups for group; in DB2 and changing table name in HSQLDB, which solved my problem. Now I map groups table, and there are no longer this problem.

Using backticks (like in your first sample) should work but you have to use them everywhere the table name is mentioned.

Dialect has openQuote() and closeQuote() methods that translate those backticks into quotes appropriate for given database. Those default to double quote (") for most databases including DB2 and HSQL. I don't have either on hand right now to try this but I've had it working for DB2 / Oracle / MySQL combination in the past.

Can you post a specific error and the stack trace you're getting?

All that said, if you can change the table name to a non-reserved word I would strongly recommend that you do - you'll save yourself a lot of headache in the end.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!