How to use scooter.jar in your data access layer

You can use Scooter without changing your current web framework.

scooter.jar can be used in your application's data access layer just like hibernate.jar or JPA.

You get the power of Scooter's Active Record and SQL Data Express without the burden of XML configuration.

Steps

It is simple. Just follow the steps below:

  1. Include the following code in your application's initialization code block
  2. ApplicationConfig.configInstanceForOrmAlone().startORMApplication();
    

    The above code line configures Scooter to run in a standalone orm mode.

  3. Put the following jar files on your application's classpath
    • scooter.jar
    • c3p0-0.9.1.2.jar
    • c3p0-oracle-thin-extras-0.9.1.2.jar
    • any jdbc jar files of your databases, e.g. mysql-connector-java-5.1.11-bin.jar for MySQL, or ojdbc14.jar for Oracle
    • log4j-1.2.15.jar (optional)

    Please note that you do not have to rename vendor's jdbc-xxx.jar to mysql.jar or oracle.jar, as required by Scooter's WEB mode.

  4. Put the following configuration property files on your application's classpath
    • database.properties
    • environment.properties
    • log4j.properties (optional)
    • sql.properties (optional)
    • locales/messages.properties (optional)

    Most of properties in environment.properties file are for running Scooter in a web container. For Scooter's ORM mode, most likely you only need to update model.class.prefix and model.class.suffix properties to specify your model class package information.

    The sql.properties file is needed for Scooter's SQL Data Express to store sql query statements. If you just use Scooter's Active Record, then you do not need this file.

    The message properties files are needed only if you need to display locale messages in your application.

  5. Set your database connection information in database.properties file

That's it.

You can look at this example which provides code samples for using Active Record and SQL Data Express: scooter-orm-sample-1.0.RC3.zip