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 75948 - Tell user about missing persistence lib in wizard if no PU
Summary: Tell user about missing persistence lib in wizard if no PU
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: Dongmei Cao
URL:
Keywords:
: 79863 80312 82871 130858 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-05-04 20:32 UTC by Rochelle Raccah
Modified: 2009-11-02 11:13 UTC (History)
3 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 Rochelle Raccah 2006-05-04 20:32:06 UTC
From a discussion with Jano & Pavel:

On 3 May 2006, at 20:44, Rochelle Raccah wrote:

> Right now the warning about no PU in the Entity from DB wizard is:
> There is no persistence unit in the project yet.  You need a  persistence unit
to persist entity classes.
>
> My proposal is to add a sentence there:
> If you do not create a persistence unit, you must manually add a  persistence
library to your project for compilation.

Jano's response:
We can do something like that. It would make the text rather long,  which might
cause users won't read it. And maybe we can specifically  mention Toplink
Essentials as they might not know be able to choose  from the list of libraries
the persistence one.

If you do not create a persistence unit, you must manually add a  persistence
library (e.g. Toplink Essentials) to your project for  compilation.
Comment 1 Erno Mononen 2006-05-12 14:09:10 UTC
Just to get this right, should the warning be updated to:

"There is no persistence unit in the project yet. You need a persistence unit
to persist entity classes. If you do not create a persistence unit, you must 
manually add a  persistence library (e.g. Toplink Essentials) to your project 
for  compilation." ? 

That seems a bit long in my opinion too.
Comment 2 jrojcek 2006-05-12 16:06:10 UTC
Lets look at this problem again and pretend we only have a basic warning in the wizard:
"There is no persistence unit in the project yet. You need a persistence unit
to persist entity classes."

Possible scenarios the user can do in this wizard:

1. The user notices the warning and creates a PU. Everything works fine.

2. The user notices the warning and doesn't create a PU because he knows he doesn't need it in his 
module that only contains entity classes and no entity manager code. In this case I think this user is 
knowledgeable enough about persistence and he knows he has to fix the classpath.

3. The user notices the warning but doesn't create PU because he doesn't know what it is and whether 
he needs it. He most likely needs a PU because he's probably just playing with persistence yet. In this 
case the user needs to find out he needs to create PU anyway. The updated warning would not help him 
IMO.

4. The user doesn't notice the warning. In this case the updated warning would not help.

Looking at this I feel like updating the warning doesn't really help a lot and maybe the updated warning 
also complicates things for those who need PU, which probably is the majority of users.

I suggest to not update the warning for now and wait for user feedback.
Comment 3 Rochelle Raccah 2006-05-12 23:58:16 UTC
How about a slightly different solution, then?  How about incorporating this
into the editor suggestions?  There will be lots of red error annotations about
not knowing javax.persistence.  Maybe one of the suggestions with the lightbulb
can be to add the persistence library.
Comment 4 jrojcek 2006-05-15 08:43:17 UTC
I think that would be the right solution. We saw somewhat related problem in the usability study. See issue 
#74690 and issue #75426.
Comment 5 Erno Mononen 2006-05-18 10:19:40 UTC
Reassigning to j2ee/editor since the latest proposal concerns that area.
Comment 6 Tomasz Slota 2006-06-02 10:53:34 UTC
There is editor warning and hint for creating PU already (when editing entity classes). It does not work if 
imports are not resolved, but I don't think we would expect it to do so.

Closing the issue after consulting Petr Pisl. If you disagree please file a new issue explaining expected 
behavior in detail.
Comment 7 Rochelle Raccah 2006-06-07 00:56:14 UTC
This was not yet solved and we saw that it was indeed a problem (even for Craig
M).  Reopening and assigning to Jano to figure out what should happen.
Comment 8 jrojcek 2006-06-27 14:43:04 UTC
Okay, if we add the persistence library automatically to classpath (the API JAR), what would be the 
unwanted consequences and complications? I tend to say we should add it automatically, but I need to 
know what can break.
Comment 9 Rochelle Raccah 2006-06-27 23:05:34 UTC
I don't think anything will break if it's added automatically.  Pavel, what do
you think?  Even if implementation jars have the APIs in them as well, the APIs
should be the same.  We should keep this jar ahead of those in the classpath,
though.
Comment 10 jrojcek 2006-06-28 11:49:55 UTC
Okay, so lets try to do it, but somebody should check all the scenarios, to make sure it works. Namely 
when user creates entity class without PU and then does any of those:

- creates another entity class without PU
- adds a PU with Toplink
- adds a PU with e.g. Hibernate

Who should I reassign this issue to?
Comment 11 jrojcek 2006-06-29 09:47:13 UTC
Hmm, maybe Martin ;-).
Comment 12 Libor Kotouc 2006-07-17 11:53:15 UTC
*** Issue 79863 has been marked as a duplicate of this issue. ***
Comment 13 Rochelle Raccah 2006-07-18 22:09:46 UTC
*** Issue 80312 has been marked as a duplicate of this issue. ***
Comment 14 Rochelle Raccah 2006-08-17 21:40:05 UTC
*** Issue 82871 has been marked as a duplicate of this issue. ***
Comment 15 Pavel Buzek 2006-08-26 00:05:26 UTC
I still do not see a clear conclusion.

I do not like the solution with automatically adding persistence API and then
toplink and hibernate as well. Having the classes on classpath twice is asking
for trouble. What if toplink or hibernate makes JPA 1.1 (even a preview)
available before we release next version of NB and users install it in NB? Then
you will have different API classes on cp before the ones from runtime. I think
we should use classes from runtime when using one.

I would be OK with using just API classes if the user does not want any runtime
(e.g. for a library project). That means adding JPA library if you choose not to
create a PU. But: We would need to create a separate library for JPA. Then maybe
some users would have problem understanding when to use JPA library vs TopLink
library or both. I think this would be an acceptable solution.

Personally, I still think it would not hurt too much if we just use the whole
runtime (i.e. toplink, hibernate, etc.) library. There is an added benefit that
the user will see additional APIs available in that runtime if that is what they
want to choose (e.g. in Hibernate). We can just add it automatically when
creating an entity if the user chooses not to create PU and if
javax.persistence.* is not on classpath. Ideally we would ask the user to select
one of the available runtimes (search the registered libraries for javax.pers.*)
but if not (we do not want to change UI for 5.5, I assume) we can just add the
first one that is in library manager or just add toplink which we bundle. Users
can replace with another one if they want. That is a simple and cheap solution
for 5.5.
Comment 16 jrojcek 2006-08-29 13:47:24 UTC
Adding the whole Toplink JAR (API + runtime) looks good to me.
Comment 17 Andrei Badea 2008-04-02 12:53:05 UTC
*** Issue 130858 has been marked as a duplicate of this issue. ***
Comment 18 Andrei Badea 2008-04-02 12:54:36 UTC
A single duplicate filed by an user (not QE) in two years. Not a P3 I think.
Comment 19 Dongmei Cao 2008-11-19 21:41:28 UTC
low priority
Comment 20 Quality Engineering 2009-11-02 11:13:13 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX