JeeSite默认为Mysql,如果想更换为Oracle数据库需要进行一下步骤:
?
1、修改pom.xml文件
?
注释掉:
<!--<jdbc.driver.groupId>mysql</jdbc.driver.groupId> <jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId> <jdbc.driver.version>5.1.13</jdbc.driver.version>-->
去掉注释:
<jdbc.driver.groupId>com.oracle</jdbc.driver.groupId> <jdbc.driver.artifactId>ojdbc14</jdbc.driver.artifactId> <jdbc.driver.version>10.2.0.1.0</jdbc.driver.version>
注释掉:
<!--<property name="sql.type" value="mysql" /> <property name="dbunit.datatype" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" /> -->
去掉注释:
<property name="sql.type" value="oracle" /> <property name="dbunit.datatype" value="org.dbunit.ext.oracle.Oracle10DataTypeFactory" />
2、修改application.properties文件
?
注释掉:
#jdbc.driver=com.mysql.jdbc.Driver #jdbc.url=jdbc:mysql://127.0.0.1:3306/jeesite?useUnicode=true&characterEncoding=utf-8 #jdbc.username=root #jdbc.password=123456
去掉注释:
jdbc.driver=oracle.jdbc.driver.OracleDriver jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl jdbc.username=jeesite jdbc.password=123456
?3、修改所有Entity文件的Id字段,修改文件包括:
?
? ? ?src/main/java/com/thinkgem/jeesite/modules/sys/entity/*.java
? ? ?src/main/java/com/thinkgem/jeesite/modules/cms/entity/*.java
?
注释掉:
//@GeneratedValue(strategy = GenerationType.IDENTITY)
?
去掉注释:
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_cms_article") @SequenceGenerator(name = "seq_cms_article", sequenceName = "seq_cms_article")
?
注意:去掉注释后需要给SequenceGenerator添加类引用,如下:
import javax.persistence.SequenceGenerator;
?
4、执行bin\refresh-db\refresh-db.bat刷新数据库(导入表结构及数据)。
?