1. Create a web application
2. Create some entities using Entity from Database wizard
3. Run the RESTful Web Services from Entity Classes wizard
Notice that the left list displays a "Retrieving..." message for a few seconds, and only after that it show the list of
available entities. Compare this to the "JSF Pages from Entity Classes" wizard, which displays the list of entities
The second panel from the wizard should be replaced by PersistenceClientEntitySelection from Java Persistence API support.
The same panel which is used in "JSF Pages from Entity Classes" wizard.
*** Bug 132796 has been marked as a duplicate of this bug. ***
It is too risky to fix this at the upcoming release .
Needs to be fixed in the next release.
This is definitely not for 7.0 release.
The problem is more deeply than just reusage of existing persistence
Wizards "JPA Controller Classes from Entity Classes" and "Sessions Beans For
Entity Classes" uses org.netbeans.modules.j2ee.persistence.wizard.EntityClosure
class which provides ONLY entity classes defined inside project folder.
On the contrary "RESTful WS from Entity Classes" wizard cares also about entity
classes in the binary classpath ( which defined in the jar files on classpath ).
This is exactly the reason of slow entities list initialization.
I don't know whether we need to care in this wizard about such entities.
There is no way to improve performance if we really need to care about
"runtime" entities .
The only thing that can be improved here : currently "runtime" entities
retrieval is badly implemented . Full scan of binary classpath is started each
time when wizard is open . Such scan is not needed when wizard is invoked
twice. This can be improved. Any following invocation of wizard will work
quickly. Only first time will be time consuming.
So there are two questions :
- Do we really need to care about "runtime" entities in the binary classpath at
- Wizard panels can be reused in case of ignoring of "runtime" entities. If we
still need to care about them then probably current panel should be kept.
It cannot be reused from j2ee.persistence module. In the latter case only
"runtime" entities initialization should be improved.
OK, I think I have found the way how it can be done in more convenient way:
- one need to refactor and adopt wizard panel which is used f.e. for
"Persistence / JPA Controller Classes from Entity " . It's current implementation
works only with entities which are defined in the project sources group
( ignore entities defined in the project jar files ).
This panel should allows to add additional entities via public methods.
So the algorithm for entities search should be : current algorithm for
entities defined in the project sources and additionally entities that could be
- existed panel should be also adopted for some UI changes. F.e. RESTful from
entities requires to handle referenced entities . So the checkbox in the
existed persistence panel should be either non visible or disabled.
- changes described above will allow to add additional entities from the usage
code. F.e. in the case of RESTful from entities one will be able to add
entities from runtime jar files : add "Retrieving..." list item instead of
real entities while search is performed. Remove this item from the list and
replace it by found entities when they are identified. The behavior is like
current except type of entities which requires a time consuming search:
entities which are defined in the project source root will be shown very quickly
( immediately ) when wizard panel is shown. And only additional entities
will be shown ( if any ) after some time. In most cases user don't want runtime
entities . So there is no need to wait until additional entities will be found.
So the navigation through the wizard could be done without any pause.
- last thing which should be also done for improving functionality : I have
already mentioned that currently search of runtime entities badly designed.
Each time this search starts from the scratch . This can be optimized by
caching entities which have been found at first time . One need to care only
about changes in the binary classpath ( listen jar additions/ deletions ).
All this changes will improve the wizard and covers all any possible
But such improvement requires a huge number of changes in two different
modules. So it is really risky to do it for the 7.0 release.
Should be done for Next release.
Integrated into 'main-golden', will be available in build *201109060600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Denis Anisimov <firstname.lastname@example.org>
Log: Fix for BZ#173038 - Slow initialization of the list of entities in REST from Entity wizard