|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--test.tester.model.dao.Story
This class, when instancied, is like a row of STORY
, 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
Story
back, and you can also do
joins (if the table has foreign keys).
Consider the following example to create a new
Story
in the database:
For selecting some rows, you can use the methods inside theStory story = new Story(); story.setStoryId(new Integer(1)); story.setTitle("test"); story.setSubtitle("text example"); story.setBody("text example"); story.setDay("02-02-2002"); story.setCategoryId(new Integer(1)); story.setMemberId(new Integer(1)); ... story.save();
StoryBroker.StoryBroker()
class, which has a lot of static methods
that return Collection
s of Story
.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_BODY
Just a reference for the real SQL name of body |
static java.lang.String |
FIELD_CATEGORY_ID
Just a reference for the real SQL name of categoryId |
static java.lang.String |
FIELD_DAY
Just a reference for the real SQL name of day |
static java.lang.String |
FIELD_MEMBER_ID
Just a reference for the real SQL name of memberId |
static java.lang.String |
FIELD_STORY_ID
Just a reference for the real SQL name of storyId |
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_STORY
Just a reference for the real SQL name of Story |
Constructor Summary | |
Story()
Dummy constructor. |
|
Story(java.sql.ResultSet resultSet)
Creates a new Story using the values from the current
row of the given resultSet. |
Method Summary | |
void |
delete()
Deletes this story . |
java.lang.String |
getBody()
Gets the body . |
java.lang.Integer |
getCategoryId()
Gets the categoryId . |
java.lang.String |
getDay()
Gets the day . |
java.lang.Integer |
getMemberId()
Gets the memberId . |
java.lang.Integer |
getStoryId()
Gets the storyId . |
java.lang.String |
getSubtitle()
Gets the subtitle . |
java.lang.String |
getTitle()
Gets the title . |
void |
save()
Saves this story . |
void |
set(java.sql.ResultSet resultSet)
Sets the content of this story ,
to the columns of the current row in the given resultSet. |
void |
setBody(java.lang.String body)
Sets the body . |
void |
setCategoryId(java.lang.Integer categoryId)
Sets the categoryId . |
void |
setDay(java.lang.String day)
Sets the day . |
void |
setMemberId(java.lang.Integer memberId)
Sets the memberId . |
void |
setStoryId(java.lang.Integer storyId)
Sets the storyId . |
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 story . |
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_STORY
public static final java.lang.String FIELD_STORY_ID
public static final java.lang.String FIELD_TITLE
public static final java.lang.String FIELD_SUBTITLE
public static final java.lang.String FIELD_BODY
public static final java.lang.String FIELD_DAY
public static final java.lang.String FIELD_CATEGORY_ID
public static final java.lang.String FIELD_MEMBER_ID
Constructor Detail |
public Story()
public Story(java.sql.ResultSet resultSet) throws DAOException
Story
using the values from the current
row of the given resultSet.
Method Detail |
public java.lang.Integer getStoryId()
storyId
.
public void setStoryId(java.lang.Integer storyId)
storyId
.
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 getBody()
body
.
public void setBody(java.lang.String body)
body
.
public java.lang.String getDay()
day
.
public void setDay(java.lang.String day)
day
.
public java.lang.Integer getCategoryId()
categoryId
.
public void setCategoryId(java.lang.Integer categoryId)
categoryId
.
public java.lang.Integer getMemberId()
memberId
.
public void setMemberId(java.lang.Integer memberId)
memberId
.
public void save() throws DAOException
story
.
If the storyId
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
story
.
If the storyId is null, that an exception is thrown.
delete
in interface MappedTable
DAOException
public void set(java.sql.ResultSet resultSet) throws DAOException
story
,
to the columns of the current row in the given resultSet.
set
in interface MappedTable
DAOException
public java.lang.String toString()
story
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |