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 181531

Summary: Warn the user if they are using JPA 2.0 with JDK 5 source/binary format
Product: javaee Reporter: Petr Jiricka <pjiricka>
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED FIXED    
Severity: normal CC: kganfield
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Petr Jiricka 2010-03-04 09:02:24 UTC
If the user is creating a persistence unit (through the PU wizard, or the Entity wizard, or the Entity from DB wizard), and the Persistence Provider is a JPA 2.0 implementation (e.g. EclipseLink 2.0), and the Java source/binary level is set to JDK 5 (or lower), the user should be warned by a warning message in the wizard, because in this case, metamodel generation using the annotation processor will not work correctly (and JDK 6 is recommended/required anyway for JPA 2).
Comment 1 Sergey Petrov 2010-03-17 15:53:41 UTC
In real even 2.0 version will be used by default user can change it to 1.0 manually in persistence.xml and use only 1.0 features.
do you have any suggestion on message? like "For jpa 2.0 it's recommended to have source level set to jdk6, your current level is {0}"?
Comment 2 Petr Jiricka 2010-03-17 18:59:44 UTC
Yes, something like that. How about:
"Source level 1.6 is recommended for JPA 2.0 (currently it is set to {0})"

Cc'ing Ken as the native speaker - Ken, what do you think?
Comment 3 Kenneth Ganfield 2010-03-18 12:10:14 UTC
Is this a warning dialog or a message in the wizard?

It could say something like this?

"Source level 1.6 is recommended for JPA 2.0. The source level for this project is currently {0}."

If the message is in the wizard, then maybe the first sentence is enough.
If the message is in a dialog, the dialog could also have a sentence that says "You can change the source level in the project's Properties window."
Comment 4 Sergey Petrov 2010-03-18 12:31:02 UTC
I don't see a good way to get source.level from persistence side, especially it may be realized differently in any based and in maven based projects.
Is it late to add something like PersistenceProjectPropertiesProvider to j2ee.persistenceapi? (after feature freeze)
Comment 5 Sergey Petrov 2010-03-19 16:19:02 UTC
miss prev comment, 
it's a message in wizards, will have "warning" view and will not block wizard.
Comment 6 Petr Jiricka 2010-03-19 18:01:29 UTC
> I don't see a good way to get source.level from persistence side

How about SourceLevelQuery in module api.java? Would that help?
Comment 7 Sergey Petrov 2010-03-19 21:16:21 UTC
Thanks, it should work, not sure why I miss it as it's used by persistence already.
Comment 8 Quality Engineering 2010-03-20 06:34:11 UTC
Integrated into 'main-golden', will be available in build *201003200200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6a3f23303539
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #181531 new provider added
Comment 9 Quality Engineering 2010-03-21 05:08:58 UTC
Integrated into 'main-golden', will be available in build *201003210200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a3ae01110ac4
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #181531 - part fix, removed unnecessary implementation, also should work in most(all) projects now
Comment 10 Sergey Petrov 2010-03-22 09:10:51 UTC
http://hg.netbeans.org/web-main/rev/06accdfa2db2
Comment 11 Quality Engineering 2010-03-23 05:13:02 UTC
Integrated into 'main-golden', will be available in build *201003230200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/06accdfa2db2
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #181531 - warning is added to entity from db wizard
Comment 12 ekenschaft 2010-05-21 13:55:56 UTC
This error message is only useful for NetBeans gurus. As a reasonably competent developer (and native English speaker) but NetBeans newbie, I have no idea what to do with it.

For starters, I have no idea what "Source level 1.6" is supposed to refer to. If you said "JDK 1.6" or "Java EE 6 SDK", I would know what you are talking about.

Even once I figure out what it means, I don't know how to fix it. The error message should give some hint of what to do about it. If the desire is to keep the error message terse, a lengthier explanation should be in the help file.

Personally, I have JDK 1.6 installed, not JDK 1.5. I suspect, therefore, that this error message is a false alarm.

I'm running NetBeans IDE 6.9 Beta in Vista, going through the NetBeans Platform CRUD Application Tutorial.
http://platform.netbeans.org/tutorials/nbm-crud.html
Comment 13 Sergey Petrov 2010-05-21 14:49:40 UTC
it's not false alarm as moist projects have 1.5/jdk5 source level by default.
but it may have sense to review the message.
Comment 14 Petr Jiricka 2010-05-21 15:01:57 UTC
Right. ekenschaft, the fact is that even if you have JDK 6 installed, you may want to target your application to run on JDK 5, and that's what the IDE does by default when you create a project. (For Maven it is even less, Maven by default targets 1.3.) To change this, go to the project's Properties dialog, Sources category, and change the Source/Binary Format to JDK 6.

How would you change the message to be more understandable? Thanks.