I know that there are tutorials how to make a small CRUD application
using NetBeans, but only with the new Swing Application Framework.
It would be great if somebody would provide tutorials how to make CRUD
applications on top of the NetBeans Platform.
Especially with the Node and Explorer APIs most example use DataObject/
FileObject and not POJOs persisted with JPA. I think the following is
quite a common requirement:
- A TopComponent containing an Explorer View showing the entities
retrieved with JPA from an embedded Java DB
- A TopComponent to edit the entries using the Bean Binding framework.
- New, Save and Delete actions to create, change and delete entities.
The view should update accordingly.
Variations for other samples:
- provide a viewer TopComponent, which displays the content of the
currently selected node and changes when the selection changes
- double-click the node: open an editor for the entity, which does not
change when node selection changes
- New action which does not persist the entity but justs opens a new
instance in the editor. When save is pressed it will be persisted.
- A more complex entitiy structure with 2 types of entities (NON-LEAF
and LEAF types) forming a tree. Depending which type is selected in the
explorer view, another viewer/ editor is need to show and manipulate its
data. 2 separate New actions will be needed.
- Get the entities from a remote EJB service instead of getting them
from an embedded Java DB
- Get the entities from a remote WebService instead of getting them from
an embedded Java DB
I think such samples would not only help me but many other people, as well, who are
creating applications unrelated to an IDE or any file-type based
application. It could also be used for evaluation purposes by project responsibles planing to create their new / move
their existing applications to the NetBeans Platform.
reassign to documentation for evaluation
I think this is a great idea
Would be great to have this. I thought about adding JPA support to apisupport wizards and such a tutorial would help a lot.
I plan on turning this outline into a tutorial:
Would that be sufficient to resolve this issue?
Geertjan, I assume you would use beans binding and JPA or Hibernate to help here?
I think it's a good start, but it would be good to have a little "bigger" sample, as proposed in the description of this
issue. We need tutorials that show us how everything can come together for JPA and EJB applications:
- the Node/Explorer API (refresh on change)
- cookies and actions for Nodes
- cookies and actions for toolbars/menus
- 2 or 3 TopComponents and their interaction (Master/ Detail)
I know it's work (and that time is money), but I think it would be good to have such a tutorial from one who knows the
NetBeans Platform and can tell us, "how you do it" with the NetBeans Platform. Trying by ourselves really takes A LOT of
time to figure that out, even after reading a whole book about the NetBeans Platform and several tutorials, and then one
is still not sure if it has been done "the right way". One who has read less has almost no chance at all, I think.
From the email@example.com mailing list:
"A recap to anyone else trying to get a nb platform module suite to
connect to your ejb's on a glassfish server":
(Start of the topic: http://forums.netbeans.org/topic3722-0-asc-0.html)
Here some more documentation on this topic is in progress:
Began making a prototype today: http://blogs.sun.com/geertjan/entry/netbeans_platform_crud
There is already plenty of info on the "GlassFish + NetBeans Platform scenario", which is one of the scenarios that this
issue seems to be concerned with. Here are some of them:
Set milestone to 7.0.
Above is yet another article (new as of today) describing a CRUD-related scenario.
puce, is this getting closer to what you were thinking about when you wrote this issue?:
Look at that and then please specify, i.e., prioritize which of the various things you've listed are most important to
you to have included. Please don't say 'all'. Please prioritize.
thanks for your work! It's great to see more documented business scenarios! :-)
As for the priorization:
Well, since you dropped the BeansBinding framework (which is a pity since I liked it, but I also see some of the
reasons) I will not priorize it here either - which at least allows us to focus on other parts.
Since you started with a JPA CRUD application we also leave the EJB and WebService scenarios for later (though they
might be more relevant to most real-world projects.)
I agree with your next step:
1. edit & save functionality
Then I suggest to continue with:
2. Update CustomerChildFactory on save.
3. Make sure the Properties TopComponent always shows the currently selected data - no matter if the Customer List
TopComponent, the Editor TopComponent or the Properties TopComponent itself has focus, Maybe add the Customer object to
the Lookup of the Node/ TopComponent? Better way?
4. Show where and how to intialize the EntityManager/ EntityManagerFactory and how to pass it to the other components.
In the module installer? Passed via a custom Lookup which spans one or several (dependent) modules? Best practice how to
implement such a Lookup?
5. New & Delete actions (to make the CRUD round-trip complete)
6. More about best practices when working with JPA. Use attached/ detached objects? Provide a data access layer?
(For others: also see the discussion on the firstname.lastname@example.org mailing list, topic "From JPA Entity to NetBeans
Puce, what do you mean by "since you dropped the beans binding framework"? Activity on it has definitely slowed (and
it's unfortunate that apparently it won't be a standard part of JDK 7), but it's still very useful and support for it is
still in the IDE
Geertjan dropped BeansBinding for now in his blog samples (the base of these tutorials).
Yes. Since it won't be in JDK 7, I'd rather not use it in this example. Plus, I'd have to go out of my way to find a
place for it in the context of this example. Both of those reasons mean that it's better to not include it.
Here's the next part of the series, published yesterday, with some tweaks today, laying the groundwork for several of
the items in puce's list:
PS: It would help a lot if everyone reading this issue would read these articles and vote for them (more people will get
to read them if it becomes more popular).
Re beans binding being dead, I certainly thought it was. There has not been any official change in the status of the
JSR since 2006:
And the last release of beans binding was in 2007. As far as I can tell from looking at their issue tracker, there has
not been a single issue resolved since then, although more than 20 issues marked as DEFECT have been submitted in that
time (in addition to a dozen more DEFECTS that were filed earlier and still unresolved).
IIRC, Scott Violet was the original author but passed it on to Shannon Hickey when he left Sun. Now it seems that
Shannon has left Sun too. The new maintainer (Richard Bair) has blogged about JavaFX and a little about the Swing
Application Framework, but I was not able to find anything in his blog about beans binding (with the exception of
comments from others wanting to know its status too).
So despite the IDE currently having support for beans binding, the future does not look bright for the framework. Since
applications hopefully outlast a particular version of the IDE, I appreciate that the articles in this series have
changed to explore other approaches. The article on explorer views and property sheets was particularly relevant and
informative in this regard.
<object width="480" height="376"><param name="movie"
type="application/x-shockwave-flash" allowfullscreen="true" width="480" height="376"></embed></object>
Here's where I'm creating the tutorial, currently in draft form:
I believe this item is now fixed. If not please reopen it.