test.tester.model.dao
Class CategoryBroker

java.lang.Object
  |
  +--test.tester.model.dao.CategoryBroker

public class CategoryBroker
extends java.lang.Object

For selecting some rows, you can create a method inside here, or use any of the ones that are already dones (most common ones).

Some methods return a single Category, like selectById(Integer).

Here is one example for getting ALL rows from the CATEGORY table:

     // as you can see, it is a static method
     // you can use here any of the select*(...) methods
     Collection result = CategoryBroker.selectAll();
     Iterator iterator = result.iterator();

     while (iterator.hasNext()) {
         Category category = (Category) iterator.next();
         System.out.println(category.toString());
     }
     
 

See Also:
Category

Constructor Summary
CategoryBroker()
           
 
Method Summary
static int count()
          Gets how many rows has this table.
static void deleteByCategoryId(java.lang.Integer categoryId)
          Deletes a Category with a given a CategoryId.
static void insert(Category category)
          Inserts a new Category in the database.
static java.util.Collection selectAll()
          Select all rows from the CATEGORY, and then returns each row as one instance of Category, all of them inside a Collection.
static Category selectByCategoryId(java.lang.Integer categoryId)
          Select a row from the CATEGORY table, given a categoryId.
static java.util.Collection selectByDescription(java.lang.String description)
          Select all rows from the CATEGORY table, given a description.
static java.util.Collection selectByName(java.lang.String name)
          Select all rows from the CATEGORY table, given a name.
static void updateByCategoryId(Category category)
          Updates a Category, using its primary key CategoryId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CategoryBroker

public CategoryBroker()
Method Detail

selectAll

public static java.util.Collection selectAll()
                                      throws DAOException
Select all rows from the CATEGORY, and then returns each row as one instance of Category, all of them inside a Collection. It never returns null, maybe a empty Collection.

DAOException

count

public static int count()
                 throws DAOException
Gets how many rows has this table.

DAOException

insert

public static void insert(Category category)
                   throws DAOException
Inserts a new Category in the database.

DAOException

deleteByCategoryId

public static void deleteByCategoryId(java.lang.Integer categoryId)
                               throws DAOException
Deletes a Category with a given a CategoryId.

DAOException

updateByCategoryId

public static void updateByCategoryId(Category category)
                               throws DAOException
Updates a Category, using its primary key CategoryId.

DAOException

selectByCategoryId

public static Category selectByCategoryId(java.lang.Integer categoryId)
                                   throws DAOException
Select a row from the CATEGORY table, given a categoryId. As categoryId is a primary key, there is no need to return a Collection.
This method can return null, if no row matches.

DAOException

selectByName

public static java.util.Collection selectByName(java.lang.String name)
                                         throws DAOException
Select all rows from the CATEGORY table, given a name. Then returns each row as one instance of Category, all of them inside a Collection. It never returns null, maybe an empty Collection.

DAOException

selectByDescription

public static java.util.Collection selectByDescription(java.lang.String description)
                                                throws DAOException
Select all rows from the CATEGORY table, given a description. Then returns each row as one instance of Category, all of them inside a Collection. It never returns null, maybe an empty Collection.

DAOException