Spring Roo Database Reverse Engineer with Oracle

So you are trying to reverse engineer an Oracle database with roo?

Unfortunately, due to licensing restrictions with the Oracle JDBC Drivers, this is a little difficult. There are a few blog posts and forum threads that address the problem but I figured I would post what worked for me here.

First, you need to download the appropriate Oracle Drivers from Oracle. The required login, stringent password requirements, nosy registration form, and general system instability made this a pretty painful step for me. I’d also like to say that companies that have password requirements that don’t allow symbols (or any other non-standard requirement) have a special place in my heart. Having to recover my password every time I go to your site virtually guarantees I will only go there when I absolutely have to (not often). Anyways, once you have it downloaded you need to install is with maven:

1 mvn install:install-file -Dfile=~/Downloads/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

Here comes the fun part. You need to create an osgi wrapper for the driver to install it in roo. Otherwise, roo cannot see the driver. Create a new folder and put the contents of the oracle roo addon pom gist I created. Now build it with maven. You may want to change some of the artifact ids and dependencies for your particular situation.

1mvn package

No open a roo shell and execute the following command:

1 osgi install --url file:///Users/me/my-osgi-project/target/the-jar-it-built.jar

Now run (in roo):

1jpa setup --provider HIBERNATE --database ORACLE
2dependency remove --groupId com.oracle --artifactId ojdbc14 --version 10.2.0.2
3dependency add --groupId com.oracle --artifactId ojdbc6 --version 11.2.0.3
4 database properties set --key database.driverClassName --value oracle.jdbc.OracleDriver
5 database properties set --key database.url --value jdbc:oracle:thin:@%YOUR_CONNECTION_INFO%
6 database properties set --key database.username --value %YOUR_USERNAME%
7 database properties set --key database.password --value %YOUR_PASSWORD%
8database reverse engineer --schema %YOUR_SCHEMA% --package ~.domain

If you have any package loading exceptions when running the reverse engineer command you can uninstall the osgi bundle, set the package to optional in the osgi pom in the IncludedPackages tag (javax.some.package.*;resolution:=optional) rebuild, then reinstall in roo.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值