|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--test.tester.model.dao.ArticlePicture
This class, when instancied, is like a row of ARTICLE_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
ArticlePicture
back, and you can also do
joins (if the table has foreign keys).
Consider the following example to create a new
ArticlePicture
in the database:
For selecting some rows, you can use the methods inside theArticlePicture articlePicture = new ArticlePicture(); articlePicture.setArticlePictureId(new Integer(1)); articlePicture.setTitle("test"); articlePicture.setBody(new ByteArrayInputStream("bytes".getBytes())); articlePicture.setThumbnail(new ByteArrayInputStream("bytes".getBytes())); articlePicture.setArticleId(new Integer(1)); ... articlePicture.save();
ArticlePictureBroker.ArticlePictureBroker()
class, which has a lot of static methods
that return Collection
s of ArticlePicture
.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_ARTICLE_ID
Just a reference for the real SQL name of articleId |
static java.lang.String |
FIELD_ARTICLE_PICTURE_ID
Just a reference for the real SQL name of articlePictureId |
static java.lang.String |
FIELD_BODY
Just a reference for the real SQL name of body |
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_ARTICLE_PICTURE
Just a reference for the real SQL name of ArticlePicture |
Constructor Summary | |
ArticlePicture()
Dummy constructor. |
|
ArticlePicture(java.sql.ResultSet resultSet)
Creates a new ArticlePicture using the values from the current
row of the given resultSet. |
Method Summary | |
void |
delete()
Deletes this articlePicture . |
java.lang.Integer |
getArticleId()
Gets the articleId . |
java.lang.Integer |
getArticlePictureId()
Gets the articlePictureId . |
java.io.ByteArrayInputStream |
getBody()
Gets the body . |
java.io.ByteArrayInputStream |
getThumbnail()
Gets the thumbnail . |
java.lang.String |
getTitle()
Gets the title . |
void |
save()
Saves this articlePicture . |
void |
set(java.sql.ResultSet resultSet)
Sets the content of this articlePicture ,
to the columns of the current row in the given resultSet. |
void |
setArticleId(java.lang.Integer articleId)
Sets the articleId . |
void |
setArticlePictureId(java.lang.Integer articlePictureId)
Sets the articlePictureId . |
void |
setBody(java.io.ByteArrayInputStream body)
Sets the body . |
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 articlePicture . |
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_ARTICLE_PICTURE
public static final java.lang.String FIELD_ARTICLE_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_ARTICLE_ID
Constructor Detail |
public ArticlePicture()
public ArticlePicture(java.sql.ResultSet resultSet) throws DAOException
ArticlePicture
using the values from the current
row of the given resultSet.
Method Detail |
public java.lang.Integer getArticlePictureId()
articlePictureId
.
public void setArticlePictureId(java.lang.Integer articlePictureId)
articlePictureId
.
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 getArticleId()
articleId
.
public void setArticleId(java.lang.Integer articleId)
articleId
.
public void save() throws DAOException
articlePicture
.
If the articlePictureId
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
articlePicture
.
If the articlePictureId is null, that an exception is thrown.
delete
in interface MappedTable
DAOException
public void set(java.sql.ResultSet resultSet) throws DAOException
articlePicture
,
to the columns of the current row in the given resultSet.
set
in interface MappedTable
DAOException
public java.lang.String toString()
articlePicture
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |