TS 65 HibernateSupport

Hibernate Support Test Specification for NetBeans 6.7

Version: 1.0
Estimated time: 2 hours
Last update: 2008/01/30
Introduction: This document contains procedures for testing Hibernate Support.
Requirements: Mysql sakila db sample connected in the IDE.


Test suite: Project support (Java Web project)

  1. Create new project w/ Hibernate Framework.
    1. Start new project wizard.
    2. Add Hibernate Framework on Frameworks page of the wizard.
    3. Select sakila db ()
    4. Finish the wizard
    • EXPECTED RESULT: hibernate.cfg.xml file should be created in Source Packages/<default package>, file content should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sakila</property>
    <property name="hibernate.connection.username">username</property>
    <property name="hibernate.connection.password">password</property>
  1. Create new Project w/o Hibenrate and add it using the Customizer.
    1. Create a new Web Project:
    2. Open project Properties
    3. Add the Hibernate Framework with sakila db connection
    • EXPECTED RESULT: hibernate.cfg.xml file should be created in Source Packages/<default package> content should look like the example above.

Test suite: hibernate.cfg.xml multiview editor

  1. Check multiview editor
    1. Open the hibernate.cfg.xml file
    2. Select the Design view
    3. Make some change in the JDBC part: chage username, password
    • EXPECTED RESULT: select the XML view and check weeather the changes
    1. Repeat this steps for next parts of the Design view

Test suite: Hibernate Reverse Engineering

  1. Create new web project with the Spring Web MVC framework
    1. Start New Mapping Files and POJOs from Database wizard (bug 198524)
    2. on the second page of the wizard select all available tables
    3. on the third page type arbitrary package name (repeat the wizard with checked/unchecked JDK5 features and for EJB3 annotations)
    4. finish the wizard
    • EXPECTED RESULT: HBM files should be generated for every table. Those files should contain property mapping as well as relationship mappings. See the following example:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<!-- Generated Jan 20, 2009 4:04:26 PM by Hibernate Tools 3.2.1.GA -->
    <class name="test.Actor" table="actor" catalog="sakila">
        <id name="actorId" type="java.lang.Short">
            <column name="actor_id" />
            <generator class="identity" />
        <property name="firstName" type="string">
            <column name="first_name" length="45" not-null="true" />
        <property name="lastName" type="string">
            <column name="last_name" length="45" not-null="true" />
        <property name="lastUpdate" type="timestamp">
            <column name="last_update" length="0" not-null="true" />
        <set name="filmActors" inverse="true">
                <column name="actor_id" not-null="true" />
            <one-to-many class="test.FilmActor" />

POJOs should be generated for every table. This should be plain java class containing fields for every column.
The hiebrnate.cfg.xml file should contain links to the HBMs:

... <mapping resource="test/Address.hbm.xml"/> <mapping resource="test/Inventory.hbm.xml"/> <mapping resource="test/Actor.hbm.xml"/> ...

Test suite: HQL Editor

  1. Create new project w/ Hibernate Framework.
    1. Invoke Run HQL action from cntx. menu on hibernate.cfg.xml
    2. Run a query
      select a from Actor a
    • EXPECTED RESULT: result should be consistent with equivalent SQL query:
      select * from actor
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo