Hi,
I’am newbie when it comes to java and need help to insert data from Mysql database into a Table. My tabel-namn in the database contains a hyphen/dash, “database-assets”, which means that I can not get TableQuery to work.
When I run my application I get my table but with no data inside.
It work’s when I use FreeformQuery("SELECT * FROM database-assets, conn), but i would preferred to use TableQuery because it is much easier for me to understand. I 'am using vaadin 7.
ps. I can’t change the table name
it would indeed seem that the query built for the TableQuery uses unquoted identifier for the table name. I’m not exactly familiar with MySQL restrictions for unquoted identifiers, but I’d guess this is the reason for the problem.
For a very quick fix, you could extend DefaultSQLGenerator and change the use of unquoted table identifier to a quoted one, and then provide your own implementation to the TableQuery. For the future Vaadin versions, you might want to create a ticket about the issue to the
vaadin trac .
Hi,
First of all thanks for your answer, but like I said earlier I’ am a beginner when it comes to Java. Could you please give me an example how I can extend DefaultSQLGenerator if it’s not to difficult.