Re: Column names with spaces
Thomas Vandahl <[email protected]>
| Newsgroups | gmane.comp.jakarta.turbine.torque.user |
|---|---|
| Message-ID | <[email protected]> |
Thoralf Rickert wrote: > Hi, > > Of course the list of problems with mssql doesn't stop... > > I've got now a xml schema from the existing database. Some "lovely boy" decided years ago that it would be nice to use spaces inside the column names of the database scheme. For example: "Time after". This is not a problem if you use the special syntax "[Time after]" in a select. But I don't have this kind of access with Torque (prove me wrong, if not). If I try to make a Criteria, Torque quits this selection with > > Malformed column name in Criteria getTableName: 'T_Stammdaten.Time after' is not of the form 'table.column' > > Okay, actually this is an error that doesn't have something to do with the real problem. Is there a way to setup a database specific syntax for column names. So in MySQL it would be "`" or in MSSQL/Sybase it would be "[" and "]". > I'm afraid even if you solved this, there would remain a Village problem, too. I found that for example updates to columns fail if these happen to have names which are "reserved words" for this type of database (example: KEY, for MySQL). That is because Village does not use proper escaping when generating SQL for these statements. > Additionally - I think the "torque" task that generates the classes should escape the spaces if it uses the database column names to generate column constants (currently it produces > > public static String TIME AFTER = "...". > > Has somebody an idea, how to get around this problem? I don't remember exactly, but does JavaName="time_after" help? Bye, Thomas.