|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--test.tester.model.dao.Link
This class, when instancied, is like a row of LINK
, creating
an object mapping into the database.
You can change its columns, then insert, update, delete...
You can do selects and get a Collection
of
Link
back, and you can also do
joins (if the table has foreign keys).
Consider the following example to create a new
Link
in the database:
For selecting some rows, you can use the methods inside theLink link = new Link(); link.setLinkId(new Integer(1)); link.setTitle("test"); link.setSubtitle("text example"); link.setLink("test"); link.setCategoryId(new Integer(1)); ... link.save();
LinkBroker.LinkBroker()
class, which has a lot of static methods
that return Collection
s of Link
.This persistence between the object and the database is not thread safe, this means that if you have a change in this row at the database, you will not get here, only if you reload it.
Field Summary | |
static java.lang.String |
FIELD_CATEGORY_ID
Just a reference for the real SQL name of categoryId |
static java.lang.String |
FIELD_LINK
Just a reference for the real SQL name of link |
static java.lang.String |
FIELD_LINK_ID
Just a reference for the real SQL name of linkId |
static java.lang.String |
FIELD_SUBTITLE
Just a reference for the real SQL name of subtitle |
static java.lang.String |
FIELD_TITLE
Just a reference for the real SQL name of title |
static java.lang.String |
TABLE_LINK
Just a reference for the real SQL name of Link |
Constructor Summary | |
Link()
Dummy constructor. |
|
Link(java.sql.ResultSet resultSet)
Creates a new Link using the values from the current
row of the given resultSet. |
Method Summary | |
void |
delete()
Deletes this link . |
java.lang.Integer |
getCategoryId()
Gets the categoryId . |
java.lang.String |
getLink()
Gets the link . |
java.lang.Integer |
getLinkId()
Gets the linkId . |
java.lang.String |
getSubtitle()
Gets the subtitle . |
java.lang.String |
getTitle()
Gets the title . |
void |
save()
Saves this link . |
void |
set(java.sql.ResultSet resultSet)
Sets the content of this link ,
to the columns of the current row in the given resultSet. |
void |
setCategoryId(java.lang.Integer categoryId)
Sets the categoryId . |
void |
setLink(java.lang.String link)
Sets the link . |
void |
setLinkId(java.lang.Integer linkId)
Sets the linkId . |
void |
setSubtitle(java.lang.String subtitle)
Sets the subtitle . |
void |
setTitle(java.lang.String title)
Sets the title . |
java.lang.String |
toString()
Returns a structured string representation of this link . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String TABLE_LINK
public static final java.lang.String FIELD_LINK_ID
public static final java.lang.String FIELD_TITLE
public static final java.lang.String FIELD_SUBTITLE
public static final java.lang.String FIELD_LINK
public static final java.lang.String FIELD_CATEGORY_ID
Constructor Detail |
public Link()
public Link(java.sql.ResultSet resultSet) throws DAOException
Link
using the values from the current
row of the given resultSet.
Method Detail |
public java.lang.Integer getLinkId()
linkId
.
public void setLinkId(java.lang.Integer linkId)
linkId
.
public java.lang.String getTitle()
title
.
public void setTitle(java.lang.String title)
title
.
public java.lang.String getSubtitle()
subtitle
.
public void setSubtitle(java.lang.String subtitle)
subtitle
.
public java.lang.String getLink()
link
.
public void setLink(java.lang.String link)
link
.
public java.lang.Integer getCategoryId()
categoryId
.
public void setCategoryId(java.lang.Integer categoryId)
categoryId
.
public void save() throws DAOException
link
.
If the linkId
is not null,
it will update it, otherwise it is a new record, then it will be inserted.Keep in mind that if you save it, and it is inserted, the primary key is NOT loaded, so if you save it again, another row will be inserted.
save
in interface MappedTable
DAOException
public void delete() throws DAOException
link
.
If the linkId is null, that an exception is thrown.
delete
in interface MappedTable
DAOException
public void set(java.sql.ResultSet resultSet) throws DAOException
link
,
to the columns of the current row in the given resultSet.
set
in interface MappedTable
DAOException
public java.lang.String toString()
link
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |