Spring Roo - JSF project with Oracle back end
Quote:
Originally Posted by
Alan Stewart
What exactly are the error messages you see? Please elaborate. There are many Roo users who have Oracle as their db and it works for them. For Roo-generated projects, any version of the Oracle driver will work. All that is required is for the dependency in the pom to be present. If you don't want to use the Spring bundled version I listed above you will have to get one of Oracle's own drivers that come with your Oracle distribution. Oracle does not have a maven repository where the driver can be installed from so you will see the error when you run the mvn clean install command. You can copy and paste the suggested command on the command line and it will install the driver to your own local maven repo. Once installed in your local repo, you won't have to install it again. It would like something like this:
Code:
mvn install:install-file -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -DgeneratePom=true -Dfile=ojdbc14.jar
I have created a Spring Roo project with JSF. I used Oracle as backend.
The steps that I followed are as follows:
=============================
1) Created a new Spring Roo Project using Springsource Tool Suite[STS]
2) Run the following Roo shell commands
persistence setup --database ORACLE --provider HIBERNATE
================================================== ========
ADDITIONAL WORK DONE
----------------------------------------
1)Downloaded "ojdbc14.jar" from http://www.java2s.com/Code/Jar/o/Dow...1410202jar.htm[Oracle demands for Licence]
2)Unzip the downloaded file and put it in /root/
3)Run the following command from System Console as root user
mvn install:install-file -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0.2 -Dpackaging=jar -DgeneratePom=true -Dfile=ojdbc14.jar
4)Copy the ojdbc14.jar into /root/.m2/repository/oracle/jdbc/driver/ojdbc14/10.2.0.4.0/
5)Updated the pom.xml file.
<dependency>
<groupId>oracle.jdbc.driver</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
</dependency>
6)Updated persistence.xml
Replace "create" by "update"
<property name="hibernate.hbm2ddl.auto" value="update"/>
================================================== ==========
database properties list
database properties set --key database.url --value jdbc:oracle:thin:@localhost:1521:SID
database properties set --key database.username --value user
database properties set --key database.password --value pass
entity jpa --class ~.domain.users
field string --fieldName firstName --notNull true ---sizeMin 5
field string --fieldName lastName
field string --fieldName designation --notNull true ---sizeMin 5
field string --fieldName email --regexp "[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+"
field string --fieldName userId --notNull true ---sizeMin 5
web jsf setup --implementation APACHE_MYFACES --library PRIMEFACES --theme ROCKET
web jsf all --package ~.jsf
perform tests
perform package
By running these Roo Shell Commands you will get a new project with Oracle back end. Also we can Test and take the Backup of project as a war file by last two commands.
I used Apache-Tomcat7 for running this project.
Note that the DB Table will automatically created with the name USERS [this is the entity we used]