Tuesday, December 30, 2008

spring and hibernate

tutorials
http://maestric.com/en/doc/java/spring/hello_world
http://www.roseindia.net/spring/index.shtml



http://www.roseindia.net/hibernate/firstexample.shtml

Monday, December 29, 2008

Tuesday, December 23, 2008

Generating Hibernate Mapping Files and POJO Classes with NetBeans

NetBeans 6.5 allows you to automatically generate POJO classes and mapping files as per the database.

Following note is extracted from netbeans Tutotial,

In this tutorial you use a POJO (plain old Java object) to represent the data in each of the tables in the database that you will use. The Java class specifies the fields for the columns in the tables and uses simple setters and getters to retrieve and write the data. To map the POJOs to the tables you can use a Hibernate mapping file or use annotations in the class.

You can use the Hibernate Mapping Files and POJOs from a Database wizard to create multiple POJOs and mapping files based on database tables. When you use the wizard you select all the tables for which you want POJOs and mapping files and the IDE then generates the files for you based on the database tables and adds the mapping entries to hibernate.cfg.xml. When you use the wizard you can choose the files that you want the IDE to generate (only the POJOs, for example) and select code generation options (generate code that uses EJB 3 annotations, for example).

Note. The IDE also has wizards to help you create individual POJOs and mapping files from scratch.

  1. Right-click the Source Packages node in the Projects window and choose New > Other to open the New File wizard.
  2. Select Hibernate Mapping Files and POJOs from a Database in the Hibernate category. Click Next.
  3. Keep the default values in the Name and Location pane. Click Next.
  4. Select hibernate.cfg.xml from the Configuration File drop down list, if not selected.
  5. Select the from Available Tables and click Add to add the tables to Selected Tables.