Documentation Home

Oracle DB

Installation

Download and install Oracle (http://www.oracle.com/technetwork/database/enterprise-edition/overview/index.html)

Setup a Database

Create a new database and a user capable of accessing this database with privileges for creating tables included (see Oracle documentation if you have questions about how to administrate databases and users).

Update the poms to use Oracle instead of HSQL

In each of your project runnable module's pom.xml (admin, site, api), find the following in the <dependencies> section:

<dependency>
    <groupId>com.broadleafcommerce</groupId>
    <artifactId>broadleaf-boot-starter-hsql-database</artifactId>
</dependency>

and replace it with

<dependency>
    <groupId>com.broadleafcommerce</groupId>
    <artifactId>broadleaf-boot-starter-database</artifactId>
</dependency>

Next, download the Oracle JDBC driver (http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html)

In order to install this JDBC driver into your Maven repo, you must run the following command, substituting version numbers depending on what you have downloaded:

mvn install:install-file -Dpackaging=jar -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1.0 -DgeneratePom=true

Finally add the Oracle JDBC connector dependency to the <dependencies> section:

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc7</artifactId>
    <version>12.1.0.1.0</version>
</dependency>

Update the Hibernate Dialect

Update the runtime properties to use the correct Oracle dialect. In core/src/main/resources/runtime-properties/common-shared.properties, you will want to update the three persistence unit dialects to say:

blPU.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

Enterprise and Multi-Tenant

You will need to update a 4th location as well:

blEventPU.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

Update the SQL Command Extractor

If you wish to utilize the heat clinic demo import scripts, edit core/src/main/resources/runtime-properties/common-shared.properties. Update the following properties to cause the system to modify the import scripts at runtime for SQL Server compatibility:

blPU.hibernate.hbm2ddl.import_files_sql_extractor=org.broadleafcommerce.common.util.sql.importsql.DemoOracleSingleLineSqlCommandExtractor
blSecurePU.hibernate.hbm2ddl.import_files_sql_extractor=org.broadleafcommerce.common.util.sql.importsql.DemoOracleSingleLineSqlCommandExtractor
blCMSStorage.hibernate.hbm2ddl.import_files_sql_extractor=org.broadleafcommerce.common.util.sql.importsql.DemoOracleSingleLineSqlCommandExtractor

Enterprise and Multi-Tenant

You will need to update a 4th location as well:

blEventPU.hibernate.hbm2ddl.import_files_sql_extractor=org.broadleafcommerce.common.util.sql.importsql.DemoOracleSingleLineSqlCommandExtractor

Add the database connection properties

In core/src/main/resources/runtime-properties/common-shared.properties, add your database connection properties like so:

# your local database username, just a user that has readwrite permissions
database.user=root
# local database password
database.password=
database.driver=oracle.jdbc.driver.OracleDriver
# this connection URL assumes that it is connecting to a schema called broadleaf
database.url=jdbc:oracle:thin:@localhost:1521/broadleaf

Note: I named my schema broadleaf, make sure you use your schema name in the url.

Update runtime properties to create the initial schema

It is likely that you will still need to initialize and seed the new Oracle schema. Ensure that these properties are set in admin/src/main/resources/runtime-properties/default.properties:

blPU.hibernate.hbm2ddl.auto=create
blEventPU.hibernate.hbm2ddl.auto=create
blSecurePU.hibernate.hbm2ddl.auto=create
blEventPU.hibernate.hbm2ddl.auto=create

After starting up the admin once, you can change all of these back to update so that any data changes stay intact. Also, add the same properties set to update to site/src/main/resources/runtime-properties/default.properties so that starting up site doesn't wipe your changes.

And that's it! You should now be up and running with Oracle.