This is a pretty common error (trying to use literal [ ] to 'wrap' elements in your mapping files) since this is indeed the correct wrapping character for several of the NH dialects (e.g., MSSQL). However, its not the correct 'wrapper character' for many others (e.g., ORA).
The guidance is to never use explicit [ ] to escape/wrap the table names (or other elements) in mapping files. The guidance is that you should instead use the back-tick ( ` ) character to encapsulate table names or other elements in the mapping files (the back-tick is usually the with the tilde (~) key on most keyboards). This will permit the dialect to correctly encapsulate string-literals in mapping elements (table names, field names, etc.). Note: a common mistake is to glance at the back-tick and perceive it as being a single-quote -- its not the same thing at all :) I've honestly never tried to use a table name with embedded [ ] literals in it as you have here, but I've certainly done so for other 'reserved' words (e.g., tables named "Order" mapped as `Order` or tables named "User.Settings" mapped as `User.Settings`) so my recommendation re: what would *probably* work would be to refer to your tablename in the mapping file as.... `something[0].else.thing` ...where there's a leading and trailing back-tick ( ` ) surrounding the entirety of your tablename. AFAIK this should permit the NH dialect to correctly escape the embedded [ ] literals for you. Let me know if this works for you~! -Steve B. On Monday, November 18, 2013 7:38:55 AM UTC-5, nldev wrote: > > I have a column in a DB called: > > someting[0].else.thing > > because there are '.' characters in the column name I have to surround it > with brackets in the hbm.xml file like so: > > [someting[0].else.thing] > > The problem is that this query is not allowed. > > The following error is produced. > > Message = "ERROR [42000] [DataDirect][OpenAccess ODBC]Syntax error in SQL > statement. syntax error line 1 at or after token <thing>." > > My question is how to get around the brackets inside the column name? > > I have tried: [someting[0].else.thing] > > [someting[0].else.thing]] > > ["someting[0].else.thing"] > > "[someting[0].else.thing]" > > '[someting[0].else.thing]' > > *Edit* > > [something[0]].else.thing] > > 'something[0].else.thing' > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
