Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344540 - "Generate Table from Entities" and SQL statement generated
Summary: "Generate Table from Entities" and SQL statement generated
Status: RESOLVED INVALID
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Neil Hauge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 04:56 EDT by Roberto Viti CLA
Modified: 2016-07-26 05:37 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Viti CLA 2011-05-03 04:56:11 EDT
Build Identifier: 20110218-0911

If you create an Entity named with a MySQL's Reserved Name, the "Generate Table from Entities" function came out with a sql string with sintax error.

We can easy work around it by forcing the correct name with @Table annotation, but you still need to add double quotes to use a correct name (e.g. "@Table (name = "\"Call\"") ).
IMHO the @Table (name = "") annotation has the responsibility to set the correct entity name that you want and not used to set the right SQL for the generator.

There's an open tread in the forum
http://www.eclipse.org/forums/index.php?t=rview&goto=667901#msg_667901

Reproducible: Always

Steps to Reproduce:
1. Create an Entity with a reserved MySQL name (e.g. Call)
2. Create a correct persistence.xml and sync it with your entity
3. Use "Generate Table from Entities" to get the error
Comment 1 Neil Hauge CLA 2011-05-03 10:42:36 EDT
I checked the DTP MySQL 5.0 definition in DTP and "CALL" is listed as a reserved word meaning that our Entity Gen should already be specifying and delimiting this table name for you as the bug suggests.  Are you defining your DB connection using the MySQL connection profile type and the MySQL JDBC Driver 5.0 driver template?
Comment 2 Neil Hauge CLA 2011-05-03 11:01:54 EDT
(In reply to comment #1)
> I checked the DTP MySQL 5.0 definition in DTP and "CALL" is listed as a
> reserved word meaning that our Entity Gen should already be specifying and
> delimiting this table name for you as the bug suggests.  Are you defining your
> DB connection using the MySQL connection profile type and the MySQL JDBC Driver
> 5.0 driver template?

Sorry...was thinking this was Entity Gen for a minute, forgot it was Table Gen that we were talking about.  I'll check to see how EclipseLink is supposed to behave in this case and get back to you.  It may be a bug or enhancement request for EclipseLink.
Comment 3 Neil Hauge CLA 2011-05-03 11:53:00 EDT
EclipseLink recommends not using reserved words in your model if possible and if you must then you must delimit them as required.  You could file an enhancement against the RT->EclipseLink project to request this functionality but I don't think it is very likely to be changed.

Closing this out as it is not a Dali specific issue.
Comment 4 Bug Menot CLA 2016-07-26 05:37:07 EDT
See bug 260637 for the EclipseLink issue.