org.agileclick.genorm.runtime
Interface GenOrmDSEnvelope

All Known Subinterfaces:
GenOrmServletDSEnvelope

public interface GenOrmDSEnvelope

One of the classes generated is a class called DSEnvelope. DSEnvelope implements this interface and can be used to pass the data source to the GenOrmDataSource methods.

Here is some code from one of the unit tests that sets up the data source

        jdbcDataSource ds = new jdbcDataSource();
        ds.setDatabase("jdbc:hsqldb:file:"+m_databaseDir+"/testdb");
        ds.setUser("sa");
        ds.setPassword("");

        //Test the connection
        Connection c = ds.getConnection();
        assertNotNull(c);
        c.close();

        m_dataSource = ds;
        GenOrmDataSource.setDataSource(new DSEnvelope(m_dataSource));
        

You can override what key generator is returned by subclassing DSEnvelope and passing your subclass to GenOrmDataSource


Method Summary
 javax.sql.DataSource getDataSource()
          Returns the java.sql.DataSource that is used to create connections from.
 GenOrmKeyGenerator getKeyGenerator(java.lang.String table)
          Returns the key generator for the specified table
 void initialize()
           
 

Method Detail

getDataSource

javax.sql.DataSource getDataSource()
Returns the java.sql.DataSource that is used to create connections from.


initialize

void initialize()

getKeyGenerator

GenOrmKeyGenerator getKeyGenerator(java.lang.String table)
Returns the key generator for the specified table