1 <!-- Oracle SEQUENCE Example using .NET 1.1 System.Data.OracleClient -->  
 2 <insert id="insertProduct-ORACLE" parameterClass="product">  
 3 #     <selectKey resultClass="int" type="pre" keyProperty="id" >  
 4 #         SELECT STOCKIDSEQUENCE.NEXTVAL AS VALUE FROM DUAL  
 5 #     </selectKey>  
 6 #     insert into PRODUCT (PRD_ID,PRD_DESCRIPTION) values (#id#,#description#)  
 7 </insert>  
 8 #   
 9 <!-- Microsoft SQL Server IDENTITY Column Example -->  
10 <insert id="insertProduct-MS-SQL" parameterClass="product">  
11 #     insert into PRODUCT (PRD_DESCRIPTION)  
12 #     values (#description#)  
13 #     <selectKey resultClass="int" type="post" keyProperty="id" >  
14 #         select @@IDENTITY as value  
15 #     </selectKey>  
16 </insert>  
17 #   
18 <!-- MySQL Example -->  
19 <insert id="insertProduct-MYSQL" parameterClass="product">  
20 #     insert into PRODUCT (PRD_DESCRIPTION)  
21 #     values (#description#)  
22 #     <selectKey resultClass="int" type="post" keyProperty="id" >  
23 #         select LAST_INSERT_ID() as value  
24 #     </selectKey> 
25 </insert> 
26 

相关文章:

  • 2021-09-09
  • 2021-10-18
  • 2022-12-23
  • 2021-09-21
  • 2021-12-13
猜你喜欢
  • 2021-10-19
  • 2022-01-19
  • 2022-12-23
  • 2021-07-20
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案