test.tester.model.dao
Class Link

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

public class Link
extends java.lang.Object
implements MappedTable

This class, when instancied, is like a row of LINK, 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 Link back, and you can also do joins (if the table has foreign keys).

Consider the following example to create a new Link in the database:

     Link link = new Link();

     link.setLinkId(new Integer(1));
     link.setTitle("test");
     link.setSubtitle("text example");
     link.setLink("test");
     link.setCategoryId(new Integer(1));
     ... 

     link.save(); 
 
For selecting some rows, you can use the methods inside the LinkBroker.LinkBroker() class, which has a lot of static methods that return Collections of Link.

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_CATEGORY_ID
          Just a reference for the real SQL name of categoryId
static java.lang.String FIELD_LINK
          Just a reference for the real SQL name of link
static java.lang.String FIELD_LINK_ID
          Just a reference for the real SQL name of linkId
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_LINK
          Just a reference for the real SQL name of Link
 
Constructor Summary
Link()
          Dummy constructor.
Link(java.sql.ResultSet resultSet)
          Creates a new Link using the values from the current row of the given resultSet.
 
Method Summary
 void delete()
          Deletes this link.
 java.lang.Integer getCategoryId()
          Gets the categoryId.
 java.lang.String getLink()
          Gets the link.
 java.lang.Integer getLinkId()
          Gets the linkId.
 java.lang.String getSubtitle()
          Gets the subtitle.
 java.lang.String getTitle()
          Gets the title.
 void save()
          Saves this link.
 void set(java.sql.ResultSet resultSet)
          Sets the content of this link, to the columns of the current row in the given resultSet.
 void setCategoryId(java.lang.Integer categoryId)
          Sets the categoryId.
 void setLink(java.lang.String link)
          Sets the link.
 void setLinkId(java.lang.Integer linkId)
          Sets the linkId.
 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 link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_LINK

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

See Also:
Constant Field Values

FIELD_LINK_ID

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

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_SUBTITLE

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

See Also:
Constant Field Values

FIELD_LINK

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

See Also:
Constant Field Values

FIELD_CATEGORY_ID

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

See Also:
Constant Field Values
Constructor Detail

Link

public Link()
Dummy constructor.


Link

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

Method Detail

getLinkId

public java.lang.Integer getLinkId()
Gets the linkId.


setLinkId

public void setLinkId(java.lang.Integer linkId)
Sets the linkId.


getTitle

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


setTitle

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


getSubtitle

public java.lang.String getSubtitle()
Gets the subtitle.


setSubtitle

public void setSubtitle(java.lang.String subtitle)
Sets the subtitle.


getLink

public java.lang.String getLink()
Gets the link.


setLink

public void setLink(java.lang.String link)
Sets the link.


getCategoryId

public java.lang.Integer getCategoryId()
Gets the categoryId.


setCategoryId

public void setCategoryId(java.lang.Integer categoryId)
Sets the categoryId.


save

public void save()
          throws DAOException
Saves this link. If the linkId 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 link. If the linkId 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 link, 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 link.

Overrides:
toString in class java.lang.Object