-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [Annotations] Quoting table and column names problem
PostPosted: Fri May 19, 2006 5:39 am 
Newbie

Joined: Wed Sep 15, 2004 9:12 am
Posts: 4
We got the following problem,

We have tables names that are reserved keywords in MySQL, like Group and Match.

Hibernate generates sql like this:
Code:
insert into Group (name) values ('bla')

We would like it to be:
Code:
insert into `Group` (`name`) values ('bla')


Default solution to this problem is add the ` to the specific table name and column name in the mapping file.
We use annotations so this solution does not apply. You cannot add ` to the @Table annotation.

An other solution would be to use other non-reserved names, but quoting should be an option in my opinion

The next solution would be to extend the MySql dialect to always provide the quotes. We are about to do this.

It would be nice to see an option to enable quoting for any dialect. So that you wouldn't need 2 versions of every dialect.

Your input on this issue would be appreciated


Hibernate version:
3.1.3 (all)
Mapping documents:
not used, using annotations

_________________
http://java-aap.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.