|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--test.tester.model.dao.StoryPicture
This class, when instancied, is like a row of STORY_PICTURE
, 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
StoryPicture
back, and you can also do
joins (if the table has foreign keys).
Consider the following example to create a new
StoryPicture
in the database:
For selecting some rows, you can use the methods inside theStoryPicture storyPicture = new StoryPicture(); storyPicture.setStoryPictureId(new Integer(1)); storyPicture.setTitle("test"); storyPicture.setBody(new ByteArrayInputStream("bytes".getBytes())); storyPicture.setThumbnail(new ByteArrayInputStream("bytes".getBytes())); storyPicture.setStoryId(new Integer(1)); ... storyPicture.save();
StoryPictureBroker.StoryPictureBroker()
class, which has a lot of static methods
that return Collection
s of StoryPicture
.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_STORY_ID
Just a reference for the real SQL name of storyId |
static java.lang.String |
FIELD_STORY_PICTURE_ID
Just a reference for the real SQL name of storyPictureId |
static java.lang.String |
FIELD_THUMBNAIL
Just a reference for the real SQL name of thumbnail |
static java.lang.String |
FIELD_TITLE
Just a reference for the real SQL name of title |
static java.lang.String |
TABLE_STORY_PICTURE
Just a reference for the real SQL name of StoryPicture |
Constructor Summary | |
StoryPicture()
Dummy constructor. |
|
StoryPicture(java.sql.ResultSet resultSet)
Creates a new StoryPicture using the values from the current
row of the given resultSet. |
Method Summary | |
void |
delete()
Deletes this storyPicture . |
java.io.ByteArrayInputStream |
getBody()
Gets the body . |
java.lang.Integer |
getStoryId()
Gets the storyId . |
java.lang.Integer |
getStoryPictureId()
Gets the storyPictureId . |
java.io.ByteArrayInputStream |
getThumbnail()
Gets the thumbnail . |
java.lang.String |
getTitle()
Gets the title . |
void |
save()
Saves this storyPicture . |
void |
set(java.sql.ResultSet resultSet)
Sets the content of this storyPicture ,
to the columns of the current row in the given resultSet. |
void |
setBody(java.io.ByteArrayInputStream body)
Sets the body . |
void |
setStoryId(java.lang.Integer storyId)
Sets the storyId . |
void |
setStoryPictureId(java.lang.Integer storyPictureId)
Sets the storyPictureId . |
void |
setThumbnail(java.io.ByteArrayInputStream thumbnail)
Sets the thumbnail . |
void |
setTitle(java.lang.String title)
Sets the title . |
java.lang.String |
toString()
Returns a structured string representation of this storyPicture . |
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_PICTURE
public static final java.lang.String FIELD_STORY_PICTURE_ID
public static final java.lang.String FIELD_TITLE
public static final java.lang.String FIELD_BODY
public static final java.lang.String FIELD_THUMBNAIL
public static final java.lang.String FIELD_STORY_ID
Constructor Detail |
public StoryPicture()
public StoryPicture(java.sql.ResultSet resultSet) throws DAOException
StoryPicture
using the values from the current
row of the given resultSet.
Method Detail |
public java.lang.Integer getStoryPictureId()
storyPictureId
.
public void setStoryPictureId(java.lang.Integer storyPictureId)
storyPictureId
.
public java.lang.String getTitle()
title
.
public void setTitle(java.lang.String title)
title
.
public java.io.ByteArrayInputStream getBody()
body
.
public void setBody(java.io.ByteArrayInputStream body)
body
.
public java.io.ByteArrayInputStream getThumbnail()
thumbnail
.
public void setThumbnail(java.io.ByteArrayInputStream thumbnail)
thumbnail
.
public java.lang.Integer getStoryId()
storyId
.
public void setStoryId(java.lang.Integer storyId)
storyId
.
public void save() throws DAOException
storyPicture
.
If the storyPictureId
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
storyPicture
.
If the storyPictureId is null, that an exception is thrown.
delete
in interface MappedTable
DAOException
public void set(java.sql.ResultSet resultSet) throws DAOException
storyPicture
,
to the columns of the current row in the given resultSet.
set
in interface MappedTable
DAOException
public java.lang.String toString()
storyPicture
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |