Bug 74481 - The IDE should signal problem if persistent fields are named with reserved words
The IDE should signal problem if persistent fields are named with reserved words
Status: RESOLVED FIXED
Product: javaee
Classification: Unclassified
Component: Persistence
5.x
All All
: P3 (vote)
: 5.x
Assigned To: Tomasz Slota
issues@javaee
:
: 74401 (view as bug list)
Depends on: 77849
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-06 09:41 UTC by Petr Pisl
Modified: 2006-07-18 13:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2006-04-06 09:41:57 UTC
The IDE should check names of entities and fields/properties, whether they are
not in clash with Toplink/DB reserved words. For example if you create entity
User, then the table will not be created in the db, because USER is reserved
word. The error/worning should inform that this is reserved word and hint should
suggest to create @Table annotations with a new name. The same if developer uses
for example year as field name. The hint should suggest @Column annotation with
different name.
Comment 1 Tomasz Slota 2006-04-06 09:57:25 UTC
*** Issue 74401 has been marked as a duplicate of this issue. ***
Comment 2 Petr Pisl 2006-04-06 10:09:55 UTC
As it is mentioned in issue #74401 similar check should be done for @Table and
@Column annotation.
Comment 3 Pavel Buzek 2006-04-06 14:15:15 UTC
Tomasz, it would be best to have a method that would check the name in
persistence API so that for example the new entity wizard could show a warning
when you type an entity name that will not work with default mapping (not an
error, but IMO a warning would be nice).
Comment 4 Tomasz Slota 2006-04-07 11:58:19 UTC
Pavle, I have added a 'PersistentObjectNameValidator' class to the 'JSR 220
Persistence' module (j2ee/persistence), so that it can be used by both:
verification and the wizards. I will take care of the verification part.
Comment 5 Tomasz Slota 2006-04-17 16:09:06 UTC
Finished.

IDE: [17.04.06 17:06] Committing "src" started
Checking in common/predicates/method/GetterOfFieldNamedWithReservedKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/method/Attic/GetterOfFieldNamedWithReservedKeywordPred.java,v
 <--  GetterOfFieldNamedWithReservedKeywordPred.java
new revision: 1.1.2.2; previous revision: 1.1.2.1
done
Checking in persistence/PersistenceAPIAnnotations.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/Attic/PersistenceAPIAnnotations.java,v
 <--  PersistenceAPIAnnotations.java
new revision: 1.1.2.5; previous revision: 1.1.2.4
done
Checking in common/predicates/field/FieldNamedWithReservedKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/field/Attic/FieldNamedWithReservedKeywordPred.java,v
 <--  FieldNamedWithReservedKeywordPred.java
new revision: 1.1.2.2; previous revision: 1.1.2.1
done
Checking in common/predicates/clazz/ClassNamedWithReservedKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/clazz/Attic/ClassNamedWithReservedKeywordPred.java,v
 <--  ClassNamedWithReservedKeywordPred.java
new revision: 1.1.2.3; previous revision: 1.1.2.2
done
Comment 6 Jindrich Sedek 2006-06-09 09:53:39 UTC
Not all of key words are included. For example "table".
No error neither warning is shown, but DB-server announce a syntax error because
of CREATE TABLE TABLE
Comment 7 Tomasz Slota 2006-06-09 11:37:20 UTC
"TABLE" is not EJBQL keyword, so it is not scrictly prohibited as entity name by the JSR220 spec. However 
being SQL keyword it is likely to cause compatibility problems, the spec discourages using such names. 
We used to show errors for any SQL reserved keywords, but there were complaints about us being too 
restictive about it, so the list of forbidden names was limited. 

The proper fix for this issue seems to be to show errors for names being EJBQL keywords and warnings for 
other SQL keywords. 
Comment 8 Tomasz Slota 2006-07-18 13:38:00 UTC
fixed. Now persistent object names that are PersistenceAPIQL keywords cause errors and another 
SQL-99 (reserved and non-reserved) keywords cause a warning.

Commit log:

IDE: [7/18/06 2:33 PM] Committing "src" started
cvs server: scheduling file `common/predicates/method/GetterNameIsSQLKeywordPred.java' for 
addition on branch `release55'
cvs server: scheduling file `persistence/rules/clazz/ClassNamedWithJavaPersistenceQLKeyword.java' for 
addition on branch `release55'
cvs server: scheduling file `persistence/rules/method/AccessorNamedWithSQLKeyword.java' for 
addition on branch `release55'
cvs server: scheduling file `common/predicates/clazz/ClassNameIsSQLKeywordPred.java' for addition 
on branch `release55'
cvs server: scheduling file `persistence/rules/clazz/ClassNamedWithSQLKeyword.java' for addition on 
branch `release55'
cvs server: scheduling file `persistence/rules/field/FieldNamedWithJavaPersistenceQLKeyword.java' for 
addition on branch `release55'
cvs server: scheduling file `persistence/rules/field/FieldNamedWithSQLKeyword.java' for addition on 
branch `release55'
cvs server: scheduling file `common/predicates/field/FieldNameIsSQLKeywordPred.java' for addition on 
branch `release55'
cvs server: scheduling file `persistence/rules/method/
AccessorNamedWithJavaPersistenceQLKeyword.java' for addition on branch `release55'
cvs server: use 'cvs commit' to add these files permanently
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/
Attic/FieldNamedWithSQLKeyword.java,v
done
Checking in persistence/rules/field/FieldNamedWithSQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/Attic/
FieldNamedWithSQLKeyword.java,v  <--  FieldNamedWithSQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
Removing persistence/rules/field/IsFieldNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/Attic/
IsFieldNamedWithJavaPersistenceQLKeyword.java,v  <--  
IsFieldNamedWithJavaPersistenceQLKeyword.java
new revision: delete; previous revision: 1.1.2.1
done
Checking in persistence/rules/field/Bundle.properties;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/Attic/
Bundle.properties,v  <--  Bundle.properties
new revision: 1.1.2.9; previous revision: 1.1.2.8
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/
Attic/FieldNamedWithJavaPersistenceQLKeyword.java,v
done
Checking in persistence/rules/field/FieldNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/field/Attic/
FieldNamedWithJavaPersistenceQLKeyword.java,v  <--  FieldNamedWithJavaPersistenceQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/
Attic/ClassNamedWithSQLKeyword.java,v
done
Checking in persistence/rules/clazz/ClassNamedWithSQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/Attic/
ClassNamedWithSQLKeyword.java,v  <--  ClassNamedWithSQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/
Attic/ClassNamedWithJavaPersistenceQLKeyword.java,v
done
Checking in persistence/rules/clazz/ClassNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/Attic/
ClassNamedWithJavaPersistenceQLKeyword.java,v  <--  ClassNamedWithJavaPersistenceQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
Removing persistence/rules/clazz/IsClassNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/Attic/
IsClassNamedWithJavaPersistenceQLKeyword.java,v  <--  
IsClassNamedWithJavaPersistenceQLKeyword.java
new revision: delete; previous revision: 1.1.2.1
done
Checking in persistence/rules/clazz/Bundle.properties;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/clazz/Attic/
Bundle.properties,v  <--  Bundle.properties
new revision: 1.1.2.7; previous revision: 1.1.2.6
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/
method/Attic/GetterNameIsSQLKeywordPred.java,v
done
Checking in common/predicates/method/GetterNameIsSQLKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/method/Attic/
GetterNameIsSQLKeywordPred.java,v  <--  GetterNameIsSQLKeywordPred.java
new revision: 1.1.2.1; previous revision: 1.1
done
Checking in persistence/PersistenceAPIProblemFinder.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/Attic/
PersistenceAPIProblemFinder.java,v  <--  PersistenceAPIProblemFinder.java
new revision: 1.1.2.18; previous revision: 1.1.2.17
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/
method/Attic/AccessorNamedWithJavaPersistenceQLKeyword.java,v
done
Checking in persistence/rules/method/AccessorNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/method/Attic/
AccessorNamedWithJavaPersistenceQLKeyword.java,v  <--  
AccessorNamedWithJavaPersistenceQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
Removing persistence/rules/method/IsAccessorNamedWithJavaPersistenceQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/method/Attic/
IsAccessorNamedWithJavaPersistenceQLKeyword.java,v  <--  
IsAccessorNamedWithJavaPersistenceQLKeyword.java
new revision: delete; previous revision: 1.1.2.1
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/
method/Attic/AccessorNamedWithSQLKeyword.java,v
done
Checking in persistence/rules/method/AccessorNamedWithSQLKeyword.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/method/Attic/
AccessorNamedWithSQLKeyword.java,v  <--  AccessorNamedWithSQLKeyword.java
new revision: 1.1.2.1; previous revision: 1.1
done
Checking in persistence/rules/method/Bundle.properties;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/persistence/rules/method/Attic/
Bundle.properties,v  <--  Bundle.properties
new revision: 1.1.2.9; previous revision: 1.1.2.8
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/field/
Attic/FieldNameIsSQLKeywordPred.java,v
done
Checking in common/predicates/field/FieldNameIsSQLKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/field/Attic/
FieldNameIsSQLKeywordPred.java,v  <--  FieldNameIsSQLKeywordPred.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file: /cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/
clazz/Attic/ClassNameIsSQLKeywordPred.java,v
done
Checking in common/predicates/clazz/ClassNameIsSQLKeywordPred.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/common/predicates/clazz/Attic/
ClassNameIsSQLKeywordPred.java,v  <--  ClassNameIsSQLKeywordPred.java
new revision: 1.1.2.1; previous revision: 1.1
done
Checking in ProblemFindingUtils.java;
/cvs/j2ee/verification/src/org/netbeans/modules/j2ee/verification/Attic/ProblemFindingUtils.java,v  
<--  ProblemFindingUtils.java
new revision: 1.1.2.13; previous revision: 1.1.2.12
done
IDE: [7/18/06 2:34 PM] Committing "src" finished


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo