|Subject:||Re: [nbusers] VWP and PU|
|From:||Craig McClanahan (crai...@apache.org)|
|Date:||Dec 15, 2006 3:34:58 pm|
On 12/15/06, Dennis Gesker <ges...@alamon.com> wrote:
I'll toot your horn for you... good presentation.
There is a section in the presentation where you drag and drop from the Run
time screen on to a drop down or table component and data providers are automatically created. Is it also possible to drag and drop and EJB3 data object on to a component? These of course don't show in the run time tab but are just classes in a package associated with a persistence.xml file.
At the moment, there is not a way to do this. Indeed, this is one of the key bits of functionality that was available in Java Studio Creator that is not (yet) available in VWP -- you could drag either EJBs or web services from the Server Navigator (a palette that does not exist in standard NetBeans) and trigger the relevant design time behavior.
Or is there a way to visually add a personDataProvider to a page in the
navigator and associate it with an EJB3 data object that is generated when you use netbeans' generate entities from database functionality?
As above, you can't create a data provider visually, or even drag the EJB3 data object visually. You can, however, add the latter to your page bean pretty easily -- simply add it like you would a property, and then add the @EJB annotation onto the instance variable that got created for you.
With regards to data providers -- we created this API in Java Studio Creator 1 (and 2) primarily because things like EJB3, JPA, and JAX-WS did not exist yet. We wanted to insulate the components from having to understand how you get to the data "inside" what could be pretty much anything.
In a Java EE 5 application, with essentially everything being based on JavaBeans, it is actually easier to bind most components directly to a bean property (as I did in the webinar case), rather than going through a data provider intermediary. The only place that is currently a bit clumsy is on the Table component -- even though you can bind the component itself (more precisely, the sourceData property of the TableRowGroup component) directly to an array or list of JavaBeans, the Table Layout customizer does not know how to deal with this situation -- for visual development its still easier to use a data provider. If you have your data in the form of an array of beans, however, that's not too hard to deal with: * Drag an ObjectArrayDataProvider off the palette, onto your page * This creates a non-visual component that is available in the outline * Click the OADP in the outline and bind it's "array" property to something that returns an array of JavaBeans. * Now, bind your table component (in the Table Layout dialog) to use the OADP data provider instead of the default one.
Craig McClanahan wrote:
Is it possible to use all the slick drop and drag functionality of VWP with the Persistance API (toplink, hibernate, etc.)?
On the VWP site there is a very good tutorial called "Using Databound Componets to Access a Database" showing how to drop/drag/bind but this does not focus on the Persistence API. Does anyone know of a similar tutorial for working with VWP and the Persistence API (toplink, etc.)?
It's not a tutorial, and I'm not really trying to toot my own horn :-), but I recorded a webinar introducing the new features of Visual Web Pack, including walking through an example of using the Java Persistence API to access information from a database, and binding it to visual components. Scroll down to the "What's New in Visual Web Pack" item, at:
The basic idea of using a JPA entity class as a property of your page bean, and then binding the JSF components to properties of this entity, is my favorite approach for using JPA and JSF together.
-- Dennis R. Gesker email: den...@alamon.com Key Id: 0xEFA10A51