|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--test.tester.model.dao.CategoryBroker
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()); }
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 |
public CategoryBroker()
Method Detail |
public static java.util.Collection selectAll() throws DAOException
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
public static int count() throws DAOException
DAOException
public static void insert(Category category) throws DAOException
Category
in the database.
DAOException
public static void deleteByCategoryId(java.lang.Integer categoryId) throws DAOException
Category
with a given a
CategoryId
.
DAOException
public static void updateByCategoryId(Category category) throws DAOException
Category
, using its primary key
CategoryId
.
DAOException
public static Category selectByCategoryId(java.lang.Integer categoryId) throws DAOException
CATEGORY
table, given a categoryId
.
As categoryId
is a primary key, there is no need
to return a Collection
.
DAOException
public static java.util.Collection selectByName(java.lang.String name) throws DAOException
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
public static java.util.Collection selectByDescription(java.lang.String description) throws DAOException
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |