Created a SQL script, InsertUser.sql, on MySQL 5...
This is the error I receive:
/* MySQL 01:00:12 */ You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ''id', 'emailAddress', 'lastAccessTime', 'login_name', '
password', 'registrationD' at line 3;
That's, like, on page 196 of my book Hibernate Made Easy! My assumption is that most people that buy my technical books rarely get past the first chapter. I'm not sure if anyone has ever read that far?
I'm wondering if the formatting for the book may be chocking MySQL. Maybe the carriage return added after or before 'VALUES' throws off the editor?
So, that SQL was what Hibernate output to the console after running the Java code given for creating Users. It looks like you need to strip a few single quotes out of there to get it to run in the MySQL editor. Here's a single line that can be put into the MySQL query window and work as is:
The carriage returns have no harming effect. Notice the first brackets () have no single quotes around id, emailAddress, etc. I also preceeded User with examscam, and took the quotes off of user. Some databases need quotes around user as it is a reserved word for most databases.
Here's the full code I used in the MySQL query browser to get things working:
The option used in the book was to just type the following into your Java editor and run it, which is the approach I'm assuming most people used. I updated the errata page on my website: