ibatis映射文件中的<selectKey>
<insertid="insert"parameterClass="projectObject"><selectKeyresultClass="java.lang.Lon...
<insert id="insert" parameterClass="projectObject">
<selectKey resultClass="java.lang.Long" keyProperty="projectId" >
SELECT HC_PROJECT_SEQ.NEXTVAL AS ID FROM DUAL
</selectKey>
INSERT INTO HC_PROJECT ( PROJECT_ID, PROJECT_NAME, PROJECT_DESCRIBE,FLAG)
VALUES ( #projectId#, #name#, #describle#,1)
</insert>
<selectKey>中间的的select语句什么意思,望详解? 展开
<selectKey resultClass="java.lang.Long" keyProperty="projectId" >
SELECT HC_PROJECT_SEQ.NEXTVAL AS ID FROM DUAL
</selectKey>
INSERT INTO HC_PROJECT ( PROJECT_ID, PROJECT_NAME, PROJECT_DESCRIBE,FLAG)
VALUES ( #projectId#, #name#, #describle#,1)
</insert>
<selectKey>中间的的select语句什么意思,望详解? 展开
1个回答
2013-07-31
展开全部
SELECT HC_PROJECT_SEQ.NEXTVAL AS ID FROM DUAL
从sequences中取下一个值.
这是序列的操作,如果有疑问,请参阅ORACLE序列.
还有,我不知道楼主为什么这样写.
可以直接写成这样
<insert id="insert" parameterClass="projectObject">
INSERT INTO HC_PROJECT ( PROJECT_ID, PROJECT_NAME, PROJECT_DESCRIBE,FLAG)
VALUES ( HC_PROJECT_SEQ.NEXTVAL, #name#, #describle#,1)
</insert>
从sequences中取下一个值.
这是序列的操作,如果有疑问,请参阅ORACLE序列.
还有,我不知道楼主为什么这样写.
可以直接写成这样
<insert id="insert" parameterClass="projectObject">
INSERT INTO HC_PROJECT ( PROJECT_ID, PROJECT_NAME, PROJECT_DESCRIBE,FLAG)
VALUES ( HC_PROJECT_SEQ.NEXTVAL, #name#, #describle#,1)
</insert>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询