org.nakedobjects.persistence.sql
Class SimpleSqlObjectMapper

java.lang.Object
  extended byorg.nakedobjects.persistence.sql.DatabaseAccess
      extended byorg.nakedobjects.persistence.sql.SimpleSqlObjectMapper
All Implemented Interfaces:
SqlObjectMapper
Direct Known Subclasses:
AutoSqlObjectMapper, SqlTableMapper

public class SimpleSqlObjectMapper
extends DatabaseAccess
implements SqlObjectMapper


Field Summary
protected  java.lang.String[] columns
           
protected  Field[] fields
           
protected  java.lang.String keyColumn
           
protected  NakedClass nakedClass
           
protected  boolean polymorphicReferences
           
protected  java.lang.String table
           
 
Fields inherited from class org.nakedobjects.persistence.sql.DatabaseAccess
store
 
Constructor Summary
SimpleSqlObjectMapper(NakedClass nakedClass, SqlObjectStore store, Field[] fields, java.lang.String table, java.lang.String[] columns, java.lang.String keyColumn, boolean polymorphicReferences)
           
SimpleSqlObjectMapper(SqlObjectStore store)
           
 
Method Summary
 void delete(NakedObject object)
           
 NakedClass getNakedClass()
           
 boolean hasInstances()
           
 void insert(NakedObject object, long id)
           
 boolean isFirstInstance(NakedObject pattern, NakedObject instance)
           
 boolean isLastInstance(NakedObject pattern, NakedObject instance)
           
 java.util.Vector nextInstances(NakedObject pattern, NakedObject fromInstance, int count)
           
 int numberOfInstances(NakedObject pattern)
           
 java.util.Vector previousInstances(NakedObject pattern, NakedObject toInstance, int count)
           
 NakedObject readObject(NakedObject object)
           
 java.lang.String toString()
           
 void update(NakedObject object)
           
protected  java.lang.String withKey(NakedObject object)
           
 
Methods inherited from class org.nakedobjects.persistence.sql.DatabaseAccess
createKey, databaseContainsTable, getConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nakedobjects.persistence.sql.SqlObjectMapper
createKey
 

Field Detail

nakedClass

protected NakedClass nakedClass

keyColumn

protected java.lang.String keyColumn

table

protected java.lang.String table

columns

protected java.lang.String[] columns

fields

protected Field[] fields

polymorphicReferences

protected boolean polymorphicReferences
Constructor Detail

SimpleSqlObjectMapper

public SimpleSqlObjectMapper(NakedClass nakedClass,
                             SqlObjectStore store,
                             Field[] fields,
                             java.lang.String table,
                             java.lang.String[] columns,
                             java.lang.String keyColumn,
                             boolean polymorphicReferences)

SimpleSqlObjectMapper

public SimpleSqlObjectMapper(SqlObjectStore store)
Method Detail

isFirstInstance

public boolean isFirstInstance(NakedObject pattern,
                               NakedObject instance)
                        throws ObjectStoreException
Specified by:
isFirstInstance in interface SqlObjectMapper
Throws:
ObjectStoreException

isLastInstance

public boolean isLastInstance(NakedObject pattern,
                              NakedObject instance)
                       throws ObjectStoreException
Specified by:
isLastInstance in interface SqlObjectMapper
Throws:
ObjectStoreException

getNakedClass

public NakedClass getNakedClass()
Specified by:
getNakedClass in interface SqlObjectMapper

delete

public void delete(NakedObject object)
            throws ObjectStoreException
Specified by:
delete in interface SqlObjectMapper
Throws:
ObjectStoreException

hasInstances

public boolean hasInstances()
                     throws ObjectStoreException
Specified by:
hasInstances in interface SqlObjectMapper
Throws:
ObjectStoreException

insert

public void insert(NakedObject object,
                   long id)
            throws ObjectStoreException
Specified by:
insert in interface SqlObjectMapper
Throws:
ObjectStoreException

nextInstances

public java.util.Vector nextInstances(NakedObject pattern,
                                      NakedObject fromInstance,
                                      int count)
                               throws ObjectStoreException
Specified by:
nextInstances in interface SqlObjectMapper
Throws:
ObjectStoreException

numberOfInstances

public int numberOfInstances(NakedObject pattern)
                      throws ObjectStoreException
Specified by:
numberOfInstances in interface SqlObjectMapper
Throws:
ObjectStoreException

previousInstances

public java.util.Vector previousInstances(NakedObject pattern,
                                          NakedObject toInstance,
                                          int count)
                                   throws ObjectStoreException
Specified by:
previousInstances in interface SqlObjectMapper
Throws:
ObjectStoreException

readObject

public NakedObject readObject(NakedObject object)
                       throws ObjectNotFoundException,
                              ObjectStoreException
Specified by:
readObject in interface SqlObjectMapper
Throws:
ObjectNotFoundException
ObjectStoreException

toString

public java.lang.String toString()

update

public void update(NakedObject object)
            throws ObjectStoreException
Specified by:
update in interface SqlObjectMapper
Throws:
ObjectStoreException

withKey

protected java.lang.String withKey(NakedObject object)