test.tester.model.dao
Class StoryPicture

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

public class StoryPicture
extends java.lang.Object
implements MappedTable

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:

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

See Also:

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

TABLE_STORY_PICTURE

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

See Also:
Constant Field Values

FIELD_STORY_PICTURE_ID

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

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_STORY_ID

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

See Also:
Constant Field Values
Constructor Detail

StoryPicture

public StoryPicture()
Dummy constructor.


StoryPicture

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

Method Detail

getStoryPictureId

public java.lang.Integer getStoryPictureId()
Gets the storyPictureId.


setStoryPictureId

public void setStoryPictureId(java.lang.Integer storyPictureId)
Sets the storyPictureId.


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.


getStoryId

public java.lang.Integer getStoryId()
Gets the storyId.


setStoryId

public void setStoryId(java.lang.Integer storyId)
Sets the storyId.


save

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

Specified by:
save in interface MappedTable
DAOException

delete

public void delete()
            throws DAOException
Deletes this storyPicture. If the storyPictureId 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 storyPicture, 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 storyPicture.

Overrides:
toString in class java.lang.Object