You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by felix thomas <re...@yahoo.co.in> on 2007/07/12 07:26:12 UTC

select Key not working giving error.

hi,

 I am getting the below error in iBatis 2 .
 
 this is my sqlMap statement



 <insert id="insertCustomObject"
parameterClass="com.sb.model.CustomObjectDetails">
    
    <selectKey resultClass="int" >
      
      SELECT record_id.NEXTVAL AS ID  FROM DUAL
    </selectKey>
      
    
    insert into OBJECT
(OBJECT_ID,NAME,SINGULAR_LABEL,PLURAL_LABEL,DESCRIPTION,IS_REPORTS_ALLOWED,IS_ACTIVITIES_ALLOWED,
   
IS_NOTES_ALLOWED,IS_TRACK_CHANGES,IS_DEPLOYED,IS_STANDARD,MODIFIED_BY,OBJECT_TYPE_ID)
values
(#ID#,#objectName#,#singularLabel#,#pluralLabel#,
   
#description#,#reportsAllowed#,#activitiesAllowed#,#notesAllowed#,#trackChanges#,#isDeployed#,'N',1,213)
   
     
   </insert> 


 It gives me Error saying ID element key  not
identified etc.

 My problem is that rest all columns are coming from
the class object, only for the insertion of column
OBJECT_ID i am getting the value from a sequence. 

is this possible in sqlmaps . Can anyone help.

Regards,
Felix T


		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/

RE: select Key not working giving error.

Posted by Si...@cognizant.com.
U can directly use SELECT record_id.NEXTVAL AS ID  FROM DUAL in the
place if #ID#

 

________________________________

From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Thursday, July 12, 2007 3:00 PM
To: user-java@ibatis.apache.org
Subject: Re: select Key not working giving error.

 

You need a property in your object to hold the generated ID.  In this
case, you need getID() and setID() methods.

 

Jeff Butler



 

On 7/12/07, felix thomas <re...@yahoo.co.in> wrote: 

hi,

I am getting the below error in iBatis 2 .

this is my sqlMap statement



<insert id="insertCustomObject" 
parameterClass="com.sb.model.CustomObjectDetails">

   <selectKey resultClass="int" >

     SELECT record_id.NEXTVAL AS ID  FROM DUAL
   </selectKey>


   insert into OBJECT 
(OBJECT_ID,NAME,SINGULAR_LABEL,PLURAL_LABEL,DESCRIPTION,IS_REPORTS_ALLOW
ED,IS_ACTIVITIES_ALLOWED,

IS_NOTES_ALLOWED,IS_TRACK_CHANGES,IS_DEPLOYED,IS_STANDARD,MODIFIED_BY,OB
JECT_TYPE_ID)
values
(#ID#,#objectName#,#singularLabel#,#pluralLabel#, 

#description#,#reportsAllowed#,#activitiesAllowed#,#notesAllowed#,#track
Changes#,#isDeployed#,'N',1,213)


  </insert>


It gives me Error saying ID element key  not
identified etc. 

My problem is that rest all columns are coming from
the class object, only for the insertion of column
OBJECT_ID i am getting the value from a sequence.

is this possible in sqlmaps . Can anyone help.

Regards,
Felix T



__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/ 

 



This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. 
Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

Re: select Key not working giving error.

Posted by Jeff Butler <je...@gmail.com>.
You need a property in your object to hold the generated ID.  In this case,
you need getID() and setID() methods.

Jeff Butler



On 7/12/07, felix thomas <re...@yahoo.co.in> wrote:
>
> hi,
>
> I am getting the below error in iBatis 2 .
>
> this is my sqlMap statement
>
>
>
> <insert id="insertCustomObject"
> parameterClass="com.sb.model.CustomObjectDetails">
>
>    <selectKey resultClass="int" >
>
>      SELECT record_id.NEXTVAL AS ID  FROM DUAL
>    </selectKey>
>
>
>    insert into OBJECT
>
> (OBJECT_ID,NAME,SINGULAR_LABEL,PLURAL_LABEL,DESCRIPTION,IS_REPORTS_ALLOWED,IS_ACTIVITIES_ALLOWED,
>
>
> IS_NOTES_ALLOWED,IS_TRACK_CHANGES,IS_DEPLOYED,IS_STANDARD,MODIFIED_BY,OBJECT_TYPE_ID)
> values
> (#ID#,#objectName#,#singularLabel#,#pluralLabel#,
>
>
> #description#,#reportsAllowed#,#activitiesAllowed#,#notesAllowed#,#trackChanges#,#isDeployed#,'N',1,213)
>
>
>   </insert>
>
>
> It gives me Error saying ID element key  not
> identified etc.
>
> My problem is that rest all columns are coming from
> the class object, only for the insertion of column
> OBJECT_ID i am getting the value from a sequence.
>
> is this possible in sqlmaps . Can anyone help.
>
> Regards,
> Felix T
>
>
>
> __________________________________________________________
> Yahoo! India Answers: Share what you know. Learn something new
> http://in.answers.yahoo.com/
>

RE: select Key not working giving error.

Posted by "Hemant.Kamatgi" <He...@target.com>.
Try this..shud work...(hope CustomObjectDetails class has get and set
for 'id' property.)

<insert id="insertCustomObject"
parameterClass="com.sb.model.CustomObjectDetails">
    
    <selectKey keyProperty="id"  resultClass="int" type="pre"> >
      
      SELECT record_id.NEXTVAL AS id  FROM DUAL
    </selectKey>
      
Insert into OBJECT
(OBJECT_ID,NAME,SINGULAR_LABEL,PLURAL_LABEL,DESCRIPTION,IS_REPORTS_ALLOW
ED,IS_ACTIVITIES_ALLOWED,
   
IS_NOTES_ALLOWED,IS_TRACK_CHANGES,IS_DEPLOYED,IS_STANDARD,MODIFIED_BY,OB
JECT_TYPE_ID)
values
(#id#,#objectName#,#singularLabel#,#pluralLabel#,
   
#description#,#reportsAllowed#,#activitiesAllowed#,#notesAllowed#,#track
Changes#,#isDeployed#,'N',1,213)


Rgds
HK
-----Original Message-----
From: felix thomas [mailto:reachfelix@yahoo.co.in] 
Sent: Thursday, July 12, 2007 12:26 AM
To: user-java@ibatis.apache.org
Subject: select Key not working giving error.

hi,

 I am getting the below error in iBatis 2 .
 
 this is my sqlMap statement



 <insert id="insertCustomObject"
parameterClass="com.sb.model.CustomObjectDetails">
    
    <selectKey resultClass="int" >
      
      SELECT record_id.NEXTVAL AS OBJECT_ID  FROM DUAL
    </selectKey>
      
    
    insert into OBJECT
(OBJECT_ID,NAME,SINGULAR_LABEL,PLURAL_LABEL,DESCRIPTION,IS_REPORTS_ALLOW
ED,IS_ACTIVITIES_ALLOWED,
   
IS_NOTES_ALLOWED,IS_TRACK_CHANGES,IS_DEPLOYED,IS_STANDARD,MODIFIED_BY,OB
JECT_TYPE_ID)
values
(#ID#,#objectName#,#singularLabel#,#pluralLabel#,
   
#description#,#reportsAllowed#,#activitiesAllowed#,#notesAllowed#,#track
Changes#,#isDeployed#,'N',1,213)
   
     
   </insert> 


 It gives me Error saying ID element key  not
identified etc.

 My problem is that rest all columns are coming from
the class object, only for the insertion of column
OBJECT_ID i am getting the value from a sequence. 

is this possible in sqlmaps . Can anyone help.

Regards,
Felix T


		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/