test.tester.model.dao
Class ArticlePicture

java.lang.Object
  |
  +--test.tester.model.dao.ArticlePicture
All Implemented Interfaces:
MappedTable

public class ArticlePicture
extends java.lang.Object
implements MappedTable

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:

     ArticlePicture 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(); 
 
For selecting some rows, you can use the methods inside the ArticlePictureBroker.ArticlePictureBroker() class, which has a lot of static methods that return Collections 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.

See Also:

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

TABLE_ARTICLE_PICTURE

public static final java.lang.String TABLE_ARTICLE_PICTURE
Just a reference for the real SQL name of ArticlePicture

See Also:
Constant Field Values

FIELD_ARTICLE_PICTURE_ID

public static final java.lang.String FIELD_ARTICLE_PICTURE_ID
Just a reference for the real SQL name of articlePictureId

See Also:
Constant Field Values

FIELD_TITLE

public static final java.lang.String FIELD_TITLE
Just a reference for the real SQL name of title

See Also:
Constant Field Values

FIELD_BODY

public static final java.lang.String FIELD_BODY
Just a reference for the real SQL name of body

See Also:
Constant Field Values

FIELD_THUMBNAIL

public static final java.lang.String FIELD_THUMBNAIL
Just a reference for the real SQL name of thumbnail

See Also:
Constant Field Values

FIELD_ARTICLE_ID

public static final java.lang.String FIELD_ARTICLE_ID
Just a reference for the real SQL name of articleId

See Also:
Constant Field Values
Constructor Detail

ArticlePicture

public ArticlePicture()
Dummy constructor.


ArticlePicture

public ArticlePicture(java.sql.ResultSet resultSet)
               throws DAOException
Creates a new ArticlePicture using the values from the current row of the given resultSet.

Method Detail

getArticlePictureId

public java.lang.Integer getArticlePictureId()
Gets the articlePictureId.


setArticlePictureId

public void setArticlePictureId(java.lang.Integer articlePictureId)
Sets the articlePictureId.


getTitle

public java.lang.String getTitle()
Gets the title.


setTitle

public void setTitle(java.lang.String title)
Sets the title.


getBody

public java.io.ByteArrayInputStream getBody()
Gets the body.


setBody

public void setBody(java.io.ByteArrayInputStream body)
Sets the body.


getThumbnail

public java.io.ByteArrayInputStream getThumbnail()
Gets the thumbnail.


setThumbnail

public void setThumbnail(java.io.ByteArrayInputStream thumbnail)
Sets the thumbnail.


getArticleId

public java.lang.Integer getArticleId()
Gets the articleId.


setArticleId

public void setArticleId(java.lang.Integer articleId)
Sets the articleId.


save

public void save()
          throws DAOException
Saves this 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.

Specified by:
save in interface MappedTable
DAOException

delete

public void delete()
            throws DAOException
Deletes this articlePicture. If the articlePictureId is null, that an exception is thrown.

Specified by:
delete in interface MappedTable
DAOException

set

public void set(java.sql.ResultSet resultSet)
         throws DAOException
Sets the content of this articlePicture, to the columns of the current row in the given resultSet.

Specified by:
set in interface MappedTable
DAOException

toString

public java.lang.String toString()
Returns a structured string representation of this articlePicture.

Overrides:
toString in class java.lang.Object