# simple-example **Repository Path**: uyghurjava/simple-example ## Basic Information - **Project Name**: simple-example - **Description**: Java Lite Sample - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-02-15 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ActiveJDBC example showing Many-To-Many This example shows a typical usage of ActiveJDBC in a Many-to-Many relationship where a join table is also used to record some metadata for each relationship Usage: * Adjust your database connection parameters in file: ``` src/main/resources/database.properties ``` * Execute database migrations: ``` mvn db-migrator:create mvn db-migrator:migrate ``` * Build program: ``` mvn clean install ``` * Execute: ``` # this will collect all dependencies under target dir. mvn dependency:unpack-dependencies # Execute the program from command line: java -classpath target/dependency:target/classes activejdbc.examples.simple.Main # Same with ActiveJDBC logging turned on: java -classpath target/dependency:target/classes -Dactivejdbc.log activejdbc.examples.simple.Main ``` * Examine the output: Line similar to this at the end: ``` Model: activejdbc.examples.simple.Movie, table: 'movies', attributes: {id=1, title=Saving private Ryan, year=1998} Model: activejdbc.examples.simple.Movie, table: 'movies', attributes: {id=2, title=Jaws, year=1982} ``` ## Instrumentation If you run this example from an IDE, you will need to instrument models before running. Here is how: mvn process-classes another way of doing the same is: mvn activejdbc-instrumentation:instrument