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 224732 - Erroneous J2EE hints/warnings when not using J2EE project.
Summary: Erroneous J2EE hints/warnings when not using J2EE project.
Status: RESOLVED DUPLICATE of bug 232006
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.2.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-11 00:57 UTC by dave.trombley
Modified: 2013-06-28 19:31 UTC (History)
2 users (show)

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 dave.trombley 2013-01-11 00:57:49 UTC
When using the javax.persistence.Entity and javax.persistence.NamedQuery annotations in a class in a non-J2EE project, the editor produces all sorts of errors such as:

- The project does not contain a persistence unit

- An entity or Id class should implement the Serializable interface

- The setter method for a persistent attribute should not be private

and so forth.

These warnings should only show in a J2EE project, and I'm not certain that they are altogether valid even then, in all cases.  However, there seems to be absolutely no way to disable them, as the IDE provides for every other kind of hint.   This is extremely frustrating and clutters up the code.  There should most definitely be an option to disable these.

An example of a valid use case is using Hibernate in a stand-alone application in which the Hibernate context is set up manually.  There is no persistence unit ever instantiated - Hibernate just uses these annotations as markers.

Further, recent versions of the very popular Spring framework seem to also be causing these hints to trigger, as they define their own PU (again, programatically, behind the scenes, not in the project).

It seems that the hints assume some very rigid things about how your project is set up, complain when your project does not conform to those expectations, and does not provide a way to disable the hints.
Comment 1 Sergey Petrov 2013-01-11 12:16:45 UTC
As persistence know nothing about hibernate/spring and it's better to keep this independence as much as possible, best would e to allow to disable this warnings.
Comment 2 Sergey Petrov 2013-04-04 12:58:49 UTC
- above comment is about pu warning.
- regarding accessors, I see only "When property access is used, the property accessor
methods must be public or protected." and nothing related to ee or se environment. but there is an issue, the warming may appear even in case of fields access as I see from code but I'm not sure if it's the reported case.
- serializable is good to implemet regardless of ee also, I suppose to keep thois warning 
"If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the
entity class must implement the Serializable interface"
serilizable entity may be used more freely.

But in general it's nice to be able to configure hints as it's possible for most java hunt (disable/enable). So if someone don't like serializable hint it will be possible to switch off.

I'm keeping this one issue open to update setter/getter hint. Configurable hints are tacked under another task issue.
Comment 3 Sergey Petrov 2013-06-28 17:56:25 UTC

*** This bug has been marked as a duplicate of bug 232006 ***
Comment 4 Michel Graciano 2013-06-28 19:18:42 UTC
I don't think this issue is a duplicate of #232006. It is about erroneous hints for non Java EE projects. The other issue is about erroneous hints for some cases at Java EE projects.
Comment 5 Michel Graciano 2013-06-28 19:22:33 UTC
To be more specific, these issue is more about non-JPA frameworks and 232006 is about JPA hint bug.
Comment 6 Sergey Petrov 2013-06-28 19:31:27 UTC
see comment #2, this issue was kept to cover the same use-case as in 232006, intiially there was a set of sunbissue and it's improper issues usage as it's much better to have one problem per issue.

*** This bug has been marked as a duplicate of bug 232006 ***