-->
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.  [ 2 posts ] 
Author Message
 Post subject: SQL Server & dash symbol in table names
PostPosted: Thu May 25, 2006 8:04 am 
Beginner
Beginner

Joined: Fri May 12, 2006 9:58 am
Posts: 32
Hibernate version:
3.1.3

Mapping documents:
... table="test-bikes" ...

Full stack trace of any exception that occurs:
Incorrect syntax near '-'.

Name and version of the database you are using:
SQL Server 2000

The generated SQL (show_sql=true):
......
from test-bikes bikes0_ where bikes0_.uid=?


I'm using the org.hibernate.dialect.SQLServerDialect dialect and I have a table called test-bikes. Saying "...from test-bikes..." in SQL Server produces an error (because of the dash symbol). In order for this table name to be valid it needs "...from [test-bikes]".

Is this a bug?
I'm not sure if my question is valid, but shouldn't that be supported in the dialect?

A temp solution might be to change all my mappings to table="[test-bikes]".
Another solution is to change the table name to something like test_bike (which I've already done).

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 25, 2006 8:22 am 
Beginner
Beginner

Joined: Fri May 12, 2006 9:58 am
Posts: 32
Ooops, I've just found that I can make the escaping happen by saying "`test-bikes`"

sorry for spamming.. plz delete this thread if you want/can


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

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.