Holger's
Java API

com.antelmann.sql
Class DetailRowStore<T extends PropertyEntry>

java.lang.Object
  extended by com.antelmann.sql.JDBCRowStore<T>
      extended by com.antelmann.sql.DetailRowStore<T>
All Implemented Interfaces:
DBClassStore<T>, TransactionRequired, MappingInfo, ProcessorHook<T,DatabaseException>

Deprecated. use PropertyEntryTableStore instead

@Deprecated
public class DetailRowStore<T extends PropertyEntry>
extends JDBCRowStore<T>

a specialized store that provides help for dealing with PropertyEntry objects, assuming that the properties are to be stored in a separate detail table. This implementation does currently NOT support PropertyEntryFilter in a special way. The mapper used with this class must completely ignore the fact that the DBEntry to be mapped is in fact a PropertyEntry. Note that fastDelete should always be left false here, because otherwise, the detail data would not be deleted if deletion is based on a filter.

Since:
23. Mai 2007, 17:24
Author:
Holger Antelmann
See Also:
PropertyEntryFilter, PropertyEntryTableStore, PropertyEntryTableStore

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.db.DBClassStore
DBClassStore.DBMethod
 
Field Summary
 
Fields inherited from class com.antelmann.sql.JDBCRowStore
database, ensureTransactionsOnFetch, helper, mapper
 
Constructor Summary
DetailRowStore(Database<Connection> db, ObjectRowMapper<T> flatMapper, Class<T> type, String detailTable, String detailIdColumn, String detailKeyColumn, String detailValueColumn)
          Deprecated.  
 
Method Summary
protected  void deleteDetails(Object id)
          Deprecated.  
 int deleteEntries(Filter<? super T> filter)
          Deprecated. supports SQLMapFilter for more effective deletion.
 boolean deleteEntry(Object id)
          Deprecated. removes the entry with the given ID from this store in the database.
 String getDetailIdColumn()
          Deprecated.  
 String getDetailKeyColumn()
          Deprecated.  
 String getDetailTable()
          Deprecated.  
 String getDetailValueColumn()
          Deprecated.  
 T getEntry(Object id)
          Deprecated. returns the DBEntry based on its ID.
 ObjectRowMapper<T> getFlatMapper()
          Deprecated. returns the embedded mapper that disregards the properties that are handled automatically by this class
protected  void initializeDetails(T entry)
          Deprecated.  
 void insert(T entry)
          Deprecated. it is suggested to create the entry with an ID obtained through generateNewID() before passing it into this method.
 Object insertAsNew(T entry)
          Deprecated. inserts the given entry using an ID generated by generateNewID while ignoring the ID of the given entry.
protected  void insertDetails(Object id, T entry)
          Deprecated. takes the additional ID since - as for insertAsNew - the ID may be different from the ID of the entry
 void update(T entry)
          Deprecated. updates the given entry in the database.
 
Methods inherited from class com.antelmann.sql.JDBCRowStore
add, checkTransaction, containsID, fetch, fetchStubs, generateNewID, getColumnNames, getColumnsForTopic, getColumnSize, getDatabase, getDisplayColumn, getDisplayNameForColumn, getEntryClass, getIDColumn, getMapper, getMappingForTopic, getSQLTypeforColumn, getStub, getTableName, getTableQuery, isFastDelete, isIgnoreInvalidProperties, remove, setFastDelete, setIgnoreInvalidProperties, size, trimIdString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DetailRowStore

public DetailRowStore(Database<Connection> db,
                      ObjectRowMapper<T> flatMapper,
                      Class<T> type,
                      String detailTable,
                      String detailIdColumn,
                      String detailKeyColumn,
                      String detailValueColumn)
Deprecated. 
Parameters:
flatMapper - the given mapper should only be concerned with mapping the object while disregarding the properties stored within. Note that instead of the given mapper, an overwriting instance is used herein, which automatically initializes the properties when instanciate(RowItem) is called. Thus, the mapper should not be changed anymore by an inheriting class.
detailTable - the name of the table that contains the detail data
detailIdColumn - the name of the column that contains the ID that mapps to the ID of the associated DBEntry (this along with the detailKeyColumn ought to be the primary key)
detailKeyColumn - the name of the column that contains the key for the property
detailValueColumn - the name of the column that contains the value for the property
Method Detail

getFlatMapper

public ObjectRowMapper<T> getFlatMapper()
Deprecated. 
returns the embedded mapper that disregards the properties that are handled automatically by this class


initializeDetails

protected void initializeDetails(T entry)
                          throws SQLException
Deprecated. 
Throws:
SQLException

insertDetails

protected void insertDetails(Object id,
                             T entry)
                      throws SQLException
Deprecated. 
takes the additional ID since - as for insertAsNew - the ID may be different from the ID of the entry

Throws:
SQLException

deleteDetails

protected void deleteDetails(Object id)
                      throws SQLException
Deprecated. 
Throws:
SQLException

getDetailTable

public String getDetailTable()
Deprecated. 

getDetailIdColumn

public String getDetailIdColumn()
Deprecated. 

getDetailKeyColumn

public String getDetailKeyColumn()
Deprecated. 

getDetailValueColumn

public String getDetailValueColumn()
Deprecated. 

getEntry

public T getEntry(Object id)
                                 throws DatabaseException
Deprecated. 
Description copied from interface: DBClassStore
returns the DBEntry based on its ID.

Specified by:
getEntry in interface DBClassStore<T extends PropertyEntry>
Overrides:
getEntry in class JDBCRowStore<T extends PropertyEntry>
Parameters:
id - the ID that is retrieved from Resource.getID()
Returns:
the associated DBEntry or null if the id is unknown
Throws:
DatabaseException
See Also:
DBEntry.getID()

deleteEntries

public int deleteEntries(Filter<? super T> filter)
                  throws DatabaseException
Deprecated. 
Description copied from class: JDBCRowStore
supports SQLMapFilter for more effective deletion. Depending on the protected member variable fastDelete this method will act differently in case of a PreparedStatementFilter, SQLMapFilter or SQLDirectQueryEntryFilter as parameter. Note that if fastDelete is true, the internalFilter of a SQLMapFilter or PreparedStatementEntryFilter is ignored!

Specified by:
deleteEntries in interface DBClassStore<T extends PropertyEntry>
Overrides:
deleteEntries in class JDBCRowStore<T extends PropertyEntry>
Returns:
the number of objects that were deleted
Throws:
DatabaseException
See Also:
SQLDirectQueryEntryFilter, PreparedStatementEntryFilter, SQLMapFilter, JDBCRowStore.fastDelete

deleteEntry

public boolean deleteEntry(Object id)
                    throws DatabaseException
Deprecated. 
Description copied from interface: DBClassStore
removes the entry with the given ID from this store in the database.

Specified by:
deleteEntry in interface DBClassStore<T extends PropertyEntry>
Overrides:
deleteEntry in class JDBCRowStore<T extends PropertyEntry>
Returns:
true only if the DBEntry with the given ID was actually found and deleted.
Throws:
DatabaseException

insertAsNew

public Object insertAsNew(T entry)
                   throws DatabaseException
Deprecated. 
Description copied from interface: DBClassStore
inserts the given entry using an ID generated by generateNewID while ignoring the ID of the given entry. With this method, the same Object (with the same ID) can be inserted multiple times, stored with a new ID on each call; the ID creation is handled automatically. This is an optional feature that might not be implemented in all cases.

Specified by:
insertAsNew in interface DBClassStore<T extends PropertyEntry>
Overrides:
insertAsNew in class JDBCRowStore<T extends PropertyEntry>
Returns:
the newly created ID of the object used as ID for the given entry to be inserted
Throws:
DatabaseException
See Also:
DBEntry.getID(), DBClassStore.generateNewID()

insert

public void insert(T entry)
            throws DatabaseException
Deprecated. 
Description copied from interface: DBClassStore
it is suggested to create the entry with an ID obtained through generateNewID() before passing it into this method. The ID of the entry must not already exist in the database.

Specified by:
insert in interface DBClassStore<T extends PropertyEntry>
Overrides:
insert in class JDBCRowStore<T extends PropertyEntry>
Throws:
DatabaseException
See Also:
DBClassStore.generateNewID()

update

public void update(T entry)
            throws DatabaseException
Deprecated. 
Description copied from interface: DBClassStore
updates the given entry in the database.

Specified by:
update in interface DBClassStore<T extends PropertyEntry>
Overrides:
update in class JDBCRowStore<T extends PropertyEntry>
Throws:
DatabaseException - if the database was not able to perform the update or it the entry didn't exist in the database before calling this method


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads