<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">
<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>
<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>
<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>
name="My Dashboard"
description="This is a dashboard"
column_layout="100%"
- shared="true"/>
+ shared="1"/>
<widgets
id="1"
description="Widget for code coverage"
column_index="13"
row_index="14"
- configured="true"/>
+ configured="1"/>
<widget_properties
id="1"
name="[null]"
description="[null]"
column_layout="[null]"
- shared="true"
+ shared="1"
created_at="[null]"
updated_at="[null]"/>
description="[null]"
column_index="[null]"
row_index="[null]"
- configured="true"
+ configured="1"
created_at="[null]"
updated_at="[null]"/>