This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 154149 - Entity class write me about error when there wasn't any one
Summary: Entity class write me about error when there wasn't any one
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-29 18:11 UTC by Martin Fousek
Modified: 2009-10-07 00:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Fousek 2008-11-29 18:11:04 UTC
Product Version: NetBeans IDE 6.5 (Build 200811100001)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Windows Vista version 6.0 running on x86; Cp1250; cs_CZ (nb)

Observed:
I created entity classes from the database. One table had name group, so I must choose anotoher name and I choose
Groups. After I opened this entity class and there was error "The entity table name is a reserved Java Persistence QL
keyword.", but when I erase "s" in word Groups and write it there again and save this document, error is gone. The error
appears everytime when I open this class again.
Comment 1 Dongmei Cao 2008-12-04 00:12:58 UTC
also see issue 147368
Comment 2 Dongmei Cao 2008-12-04 00:21:58 UTC
What database did you use? "group" is an invalid database table name.
Comment 3 Martin Fousek 2008-12-08 07:22:16 UTC
I'm using MySQL5 database.
Comment 4 Sergey Petrov 2009-07-23 11:36:03 UTC
may be a duplicate of issue 153944
Comment 5 Sergey Petrov 2009-10-01 13:45:44 UTC
reproducible in 6.8(091001), except alternative name, it was automatically generated as 'Group1'
Comment 6 Sergey Petrov 2009-10-01 13:47:02 UTC
and error isn't gone away after edition.
Comment 7 Sergey Petrov 2009-10-01 14:44:12 UTC
neither toplink nor eclipselink nor hibernate can't persist this object. so even if this one minor issue will be fixed
and there will be no error badges, in real application this entity/table will fail  to work properly. also it may be
hard to have general fix for all kind of databases as mysql require `` for such table names, others databased may
require "" etc. for example see https://bugs.eclipse.org/bugs/show_bug.cgi?id=271782

I'm not sure if it's good just to remove this error badge but in my opinion it's not even p3 as it's anyway not usable
entity and user is notified about problems, may be as a fix message should be about SQL reserved work instead of EJB QL
and badge should point to entity annotation if entity annotation exist to be more clear. Also from my expirience there
are almost no restictions on entity names itself, for example next ejb ql works 'select count(o) from as as o'. and it
means fix should be just to change "reserved Java Persistence QL" with "reserved SQL keyword".
Comment 8 Sergey Petrov 2009-10-01 15:19:23 UTC
decided to fix in 6.8 as already found all related to the issue:
http://hg.netbeans.org/web-main/rev/efd72dbbff17
http://hg.netbeans.org/web-main/rev/95488db712be
http://hg.netbeans.org/web-main/rev/433f38ebf1f4

now first table foe SQL keyword is verified as it cause problems with all (almost all) providers and a some databases.
next entity name is verified for EJB QL keyword, but it's warning now, not error as there seems to be no real
restictions according to spec and verification with eclipselink 2.0.
Comment 9 Quality Engineering 2009-10-05 08:49:59 UTC
Integrated into 'main-golden', will be available in build *200910030241* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/efd72dbbff17
User: sergeyp@netbeans.org
Log: fix #154149 - as in real table name is verified. Also according to tests with eclipselink and from specification "Reserved identifiers must not be used as identification variables or result variables" it seems there should be no restrictions on entity name itself only on identifiers in EJB QL queries. do not remove ejb ql check completely but check for sql first and mark as SQL reserved then. conside later remove EJB QL verification here.
Comment 10 Quality Engineering 2009-10-07 00:07:44 UTC
Integrated into 'main-golden', will be available in build *200910061401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/efd72dbbff17
User: sergeyp@netbeans.org
Log: fix #154149 - as in real table name is verified. Also according to tests with eclipselink and from specification "Reserved identifiers must not be used as identification variables or result variables" it seems there should be no restrictions on entity name itself only on identifiers in EJB QL queries. do not remove ejb ql check completely but check for sql first and mark as SQL reserved then. conside later remove EJB QL verification here.