ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject RE: selectkey in sybase
Date Wed, 30 May 2007 05:46:52 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META boundary="------------050207050806070708020409" alternative; multipart 
Content-Type:>
<META boundary="------------010602080904000607070308" multipart Content-Type: 
related;>
<META http-equiv=Content-Type content="text/html; charset=us-ascii" 
Content-Type: --------------010602080904000607070308 html; text quoted-printable 
Content-Transfer-Encoding:>
<META content="MSHTML 6.00.6000.16441" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=111084105-30052007><FONT face=Arial 
color=#0000ff size=2>I think you need to specify the alias as 
follows:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=111084105-30052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=111084105-30052007>
<P align=left><FONT size=2><FONT color=#008080>&lt;</FONT><FONT

color=#3f7f7f>selectKey </FONT><FONT color=#7f007f>keyProperty</FONT>=<FONT

color=#2a00ff>"<SPAN class=111084105-30052007>tkreq</SPAN>" </FONT><FONT

color=#7f007f>type</FONT>=<FONT color=#2a00ff>"post" </FONT><FONT

color=#7f007f>resultClass</FONT>=<FONT 
color=#2a00ff>"java.lang.Long"</FONT><FONT color=#008080>&gt;</P></FONT></FONT>
<P align=left><FONT size=2>select @@IDENTITY AS&nbsp;<SPAN 
class=111084105-30052007>tkreq</SPAN></FONT></P>
<P align=left><FONT size=2><FONT color=#008080>&lt;/</FONT><FONT

color=#3f7f7f>selectKey</FONT><FONT color=#008080>&gt;</FONT></FONT></P>
<P align=left><FONT><FONT color=#008080><SPAN class=111084105-30052007><FONT

face=Arial color=#0000ff size=2>and it is always a good idea to specify the 
type. (pre or post) I can't remember which is the default so I always specify 
the value so it is clear. This should work as I am using it with Sybase ASE 12.0 
without any issues.</FONT></SPAN></P></FONT></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Emiliano Armellin 
&lt;earmellin@ateikon.com&gt; [mailto:Emiliano Armellin 
&lt;earmellin@ateikon.com&gt;] <BR><B>Sent:</B> Monday, May 28,
2007 2:39 
AM<BR><B>To:</B> user-java@ibatis.apache.org<BR><B>Subject:</B>
selectkey in 
sybase<BR></FONT><BR></DIV>
<DIV></DIV>Hello, <BR><BR>I'm trying the selectkey statement in sybase,
using 
abator generated map but I've got this 
error:<BR><BR><CODE>org.springframework.jdbc.UncategorizedSQLException:

SqlMapClient operation; uncategorized SQLException for SQL []; SQL state 
[JZ0TE]; error code [0];&nbsp;&nbsp; <BR>--- The error occurred in 
com/ateikon/internet/eprogen/dao/ibatis/maps/pgmr/pgmr_atk_request_SqlMap.xml.&nbsp; 
<BR>--- The error occurred while applying a result map.&nbsp; <BR>--- Check
the 
pgmr_atk_request.abatorgenerated_insert-SelectKey-AutoResultMap.&nbsp; <BR>--- 
Check the result mapping for the '@@identity' property.&nbsp; <BR>--- Cause: 
java.sql.SQLException: JZ0TE: Attempted conversion between an illegal pair of 
types. Valid database datatypes are: 'tinyint, smallint, int, bit, float, 
decimal, numeric, char, unichar, varchar, univarchar, text, unitext,&nbsp; 
money, short money, unsigned bigint'; nested exception is 
com.ibatis.common.jdbc.exception.NestedSQLException:&nbsp;&nbsp; 
</CODE><BR><BR><BR>the generated insert:<BR><BR><CODE>&nbsp;
&lt;insert 
id="abatorgenerated_insert" 
parameterClass="com.ateikon.internet.eprogen.domain.pgmr.Atk_request"&gt;<BR>&nbsp;&nbsp;&nbsp;

insert into pgmr.atk_request (emaildest, cdazie, cddipa, profil, dtinse, 
dtulag)<BR>&nbsp;&nbsp;&nbsp; values (#emaildest:VARCHAR#, #cdazie:VARCHAR#,

#cddipa:VARCHAR#, #profil:VARCHAR#,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

#dtinse:TIMESTAMP#, #dtulag:TIMESTAMP#)<BR>&nbsp;&nbsp;&nbsp; &lt;selectKey

keyProperty="tkreq" 
resultClass="java.lang.Long"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
select 
@@identity<BR>&nbsp;&nbsp;&nbsp; &lt;/selectKey&gt;<BR>&nbsp;

&lt;/insert&gt;<BR><BR><BR></CODE><BR>it seems correct...
so why thi error? I 
can't set selectkey result map... <BR><BR>thanks<BR><BR>
<DIV class=moz-signature>-- <BR>
<DIV style="FONT-FAMILY: Georgia,serif">Emiliano Armellin 
<UL 
style="PADDING-RIGHT: 0pt; LIST-STYLE: none none outside; PADDING-LEFT: 0pt; PADDING-BOTTOM:
0pt; MARGIN: 5px 0pt 5px 5px; BORDER-LEFT: black 1px solid; TEXT-INDENT: 0pt; PADDING-TOP:
0pt">
  <LI>
  <DIV 
  style="FLOAT: left; WIDTH: 30px; MARGIN-RIGHT: 5px; TEXT-ALIGN: right">W_</DIV><A

  href="http://www.ateikon.com">www.ateikon.com</A> 
  <LI>
  <DIV 
  style="FLOAT: left; WIDTH: 30px; MARGIN-RIGHT: 5px; TEXT-ALIGN: right">@_</DIV><A

  href="mailto:earmellin@ateikon.com">earmellin@ateikon.com</A> 
  <LI>
  <DIV 
  style="FLOAT: left; WIDTH: 30px; MARGIN-RIGHT: 5px; TEXT-ALIGN: right">T_</DIV><STRONG>+39

  0422 452101</STRONG> </LI></UL>
<DIV style="FLOAT: left"><A 
href="http://www.spreadfirefox.com/?q=affiliates&amp;id=15653&amp;t=86"><IMG

title="Get Firefox!" height=31 alt="Get Firefox!" 
src="cid:part1.00010709.00000507@ateikon.com" width=88 border=0></A></DIV>
<DIV><A title="Get Thunderbird - Reclaim Your Inbox" 
href="http://www.mozilla.org/products/thunderbird/"><IMG height=32 
alt="Get Thunderbird" src="cid:part2.06080700.05040009@ateikon.com" width=110 
border=0></A></DIV></DIV></DIV></BODY></HTML>


Mime
View raw message