- Create the project making sure that the deployment target is the bundled Tomcat and not AppServer 9 (if you don't then you'll have to set up connection pools etc.)
- Add the domain model jar (which includes the persistence.xml file in the META-INF directory) to the new VWP project's libraries
- Also add the MySQL JDBC Driver and Toplink Essentials jars to the libraries
- Right click on the Application Bean in the Outline View and Add > Property and enter a name for your Session Facade variable and the name of the class
- Do this again for the field which you want to store your retreived info from the database (i.e. "username / String")
- In the constructor for the Application Bean initialise the Session Facade and then the storage field by calling the newly created facade to get the info you require from the database
- On Page1 Design View, drag a Static Text component onto the designer
- Switch to the Java view and in the prerender method set the text for the new component to be that which you just looked up and stored
- Hit deploy
- Et voila!
Friday, December 22, 2006
Netbeans VWP and My JPA1.0 Domain Model in Tomcat 5.5.17
I've been meaning to get this going for a while now and finally got round to it tonight. I have a domain model written using JPA1.0 annotations, Toplink for the implementation and MySQL for the RDBMS. I have it all masked off nicely behind a Session Facade and packaged into a simple jar. i want to call this from my Netbeans Visual Web Pack apps. Here's how I did it:
Labels:
vwp netbeans JPA howto
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment