diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-14 14:59:45 +0100 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-14 15:10:52 +0100 |
commit | 5772c4892c4529f17d2355df7dd02bc9cc8d497f (patch) | |
tree | b97a509d53725243f9babcb89567b3f4a89df4bb /sonar-core | |
parent | 82e46483e92936aeede1aef0e8658937e0fbf1e1 (diff) | |
download | sonarqube-5772c4892c4529f17d2355df7dd02bc9cc8d497f.tar.gz sonarqube-5772c4892c4529f17d2355df7dd02bc9cc8d497f.zip |
SONAR-1929 Fix problem with MyBatis on Oracle
Diffstat (limited to 'sonar-core')
6 files changed, 26 insertions, 14 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/ActiveDashboardMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/ActiveDashboardMapper-oracle.xml index 2bfb90f8e45..a03aa4c2b13 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/ActiveDashboardMapper-oracle.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/ActiveDashboardMapper-oracle.xml @@ -3,9 +3,12 @@ <mapper namespace="org.sonar.persistence.model.ActiveDashboardMapper"> - <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="false" keyProperty ="id"> + <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> + <selectKey order="BEFORE" resultType="Long" keyProperty="id" > + select active_dashboards_seq.NEXTVAL from DUAL + </selectKey> INSERT INTO active_dashboards (id, dashboard_id, user_id, order_index) - VALUES (active_dashboards_seq.NEXTVAL, #{dashboardId}, #{userId, jdbcType=FLOAT}, #{orderIndex}) + VALUES (#{id}, #{dashboardId}, #{userId, jdbcType=FLOAT}, #{orderIndex}) </insert> <select id="selectMaxOrderIndexForNullUser" resultType="Integer"> diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/DashboardMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/DashboardMapper-oracle.xml index 9ecb62c0b7d..6bdc37cac9d 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/DashboardMapper-oracle.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/DashboardMapper-oracle.xml @@ -3,9 +3,12 @@ <mapper namespace="org.sonar.persistence.model.DashboardMapper"> - <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="false" keyProperty ="id"> + <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> + <selectKey order="BEFORE" resultType="Long" keyProperty="id" > + select dashboards_seq.NEXTVAL from DUAL + </selectKey> INSERT INTO dashboards (id, kee, user_id, name, description, column_layout, shared, created_at, updated_at) - VALUES (dashboards_seq.NEXTVAL, #{key}, #{userId, jdbcType=FLOAT}, #{name, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, + VALUES (#{id}, #{key}, #{userId, jdbcType=FLOAT}, #{name, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{columnLayout, jdbcType=INTEGER}, #{shared}, #{createdAt, jdbcType=TIMESTAMP}, #{updatedAt, jdbcType=TIMESTAMP}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/LoadedTemplateMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/LoadedTemplateMapper-oracle.xml index 071898d2af8..f6af7c06b64 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/LoadedTemplateMapper-oracle.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/LoadedTemplateMapper-oracle.xml @@ -6,18 +6,21 @@ <resultMap id="loadedTemplateResultMap" type="LoadedTemplate"> <result property="id" column="id"/> <result property="key" column="kee"/> - <result property="type" column="type"/> + <result property="type" column="template_type"/> </resultMap> - <select id="selectByKeyAndType" parameterType="map" resultType="LoadedTemplate"> + <select id="selectByKeyAndType" parameterType="map" resultMap="loadedTemplateResultMap"> SELECT id, kee, template_type FROM loaded_templates WHERE kee = #{key} AND template_type = #{type} </select> - <insert id="insert" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="false" keyProperty ="id"> + <insert id="insert" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> + <selectKey order="BEFORE" resultType="Long" keyProperty="id" > + select loaded_templates_seq.NEXTVAL from DUAL + </selectKey> INSERT INTO loaded_templates (id, kee, template_type) - VALUES (loaded_templates.NEXTVAL, #{key}, #{type}) + VALUES (#{id}, #{key}, #{type}) </insert> </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/WidgetMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/WidgetMapper-oracle.xml index c6602d5179a..7c9891c21be 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/WidgetMapper-oracle.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/WidgetMapper-oracle.xml @@ -3,9 +3,12 @@ <mapper namespace="org.sonar.persistence.model.WidgetMapper"> - <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="false" keyProperty ="id"> + <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> + <selectKey order="BEFORE" resultType="Long" keyProperty="id" > + select widgets_seq.NEXTVAL from DUAL + </selectKey> INSERT INTO widgets (id, dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at) - VALUES (widgets_seq.NEXTVAL, #{dashboardId}, #{key}, #{name, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{columnIndex, jdbcType=INTEGER}, + VALUES (#{id}, #{dashboardId}, #{key}, #{name, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{columnIndex, jdbcType=INTEGER}, #{rowIndex, jdbcType=INTEGER}, #{configured}, #{createdAt, jdbcType=TIMESTAMP}, #{updatedAt, jdbcType=TIMESTAMP}) </insert> diff --git a/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsert-result.xml b/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsert-result.xml index 5f4e92ddd80..9515145dcce 100644 --- a/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsert-result.xml +++ b/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsert-result.xml @@ -7,7 +7,7 @@ name="My Dashboard" description="This is a dashboard" column_layout="100%" - shared="true"/> + shared="1"/> <widgets id="1" @@ -17,7 +17,7 @@ description="Widget for code coverage" column_index="13" row_index="14" - configured="true"/> + configured="1"/> <widget_properties id="1" diff --git a/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml b/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml index 158c1fd610d..729b5deef89 100644 --- a/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml +++ b/sonar-core/src/test/resources/org/sonar/persistence/dao/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml @@ -7,7 +7,7 @@ name="[null]" description="[null]" column_layout="[null]" - shared="true" + shared="1" created_at="[null]" updated_at="[null]"/> @@ -19,7 +19,7 @@ description="[null]" column_index="[null]" row_index="[null]" - configured="true" + configured="1" created_at="[null]" updated_at="[null]"/> |