Thanks for the response, I am very new to all this, I am really not sure
if it is or not, I will try but if you can shed any light on this I
would appreciate it.
Dwight S. Galloway
(801) 538-4234
[EMAIL PROTECTED]
Office of Technology
Department of Human Services
MAKE IT A GREAT DAY!
>>> [EMAIL PROTECTED] 6/13/2005 8:49 PM >>>
Is it not the same as MS SQL Server?
Cheers,
Clinton
On 6/13/05, Dwight Galloway <[EMAIL PROTECTED]> wrote:
>
> there are several examples of the Auto-generated key but not for
Sybase,
> like the examples below can you provide one for sybase I have the
> following.... can anyone please help.....
>
> ******************my java ***************************
> // Save the Provider that was created
> private ProviderBean saveProvider(ProviderBean pb){
> SqlMapClient sqlMap = BSSqlMapConfig.getSqlMapInstance();
> try {
> sqlMap.startTransaction();
> System.out.println("we made it here * INSERT *line 159 pb = ");
> Integer generatedProviderID = (Integer)
sqlMap.insert("insertProvider",
> pb);
> pb.setId(generatedProviderID);
> System.out.println("we made it here line 164 " + pb.getId());
> sqlMap.commitTransaction();
> }
> catch (SQLException e){
> e.printStackTrace();
> }
> finally {
> try {
> sqlMap.endTransaction();
> } catch (SQLException e1) {
> e1.printStackTrace();
> }
> }
> return null;
> }
>
> ************************ my XML *********************
>
> <insert id="insertProvider" parameterClass="
> gov.utah.dhs.dsamh.bs.beans.ProviderBean">
> INSERT INTO
> tbl_provider (program, short_program, provider_name,
> address, address_2, city,
> state, zip_code, zip_code_extension,
> area_code, phone, phone_extension,
> url_address, email, contact_name,
> fax_area, fax, system_user_id,
> create_date)
>
> values (#program#, #shortProgram#, #providerName#,
> #address1#, #address2#, #city#,
> #state#, #zipCode#, #zipCodeExtension#,
> #areaCode#, #phone#, #phoneExtension#,
> #urlAddress#, #email#, #contactName#,
> #faxArea#, #fax#, #systemUser#,
> #createDate#)
>
> <selectKey resultClass="Integer" keyProperty="id">
> SELECT LAST_INSERT_ID() AS id
> </selectKey>
> </insert>
>
>
>
>
>
>
>
> <!*Oracle SEQUENCE Example -->
> <insert id="insertProduct-ORACLE"
parameterClass="com.domain.Product">
> <selectKey resultClass="int" keyProperty="id" >
> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
> </selectKey>
> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
> values (#id#,#description#)
> </insert>
> <!* Microsoft SQL Server IDENTITY Column Example -->
> <insert id="insertProduct-MS-SQL"
parameterClass="com.domain.Product">
> insert into PRODUCT (PRD_DESCRIPTION)
> values (#description#)
> <selectKey resultClass="int" keyProperty="id" >
> SELECT @@IDENTITY AS ID
> </selectKey>
> </insert>
>
>
> i
>
> Dwight S. Galloway
> (801) 538-4234
> [EMAIL PROTECTED]
> Office of Technology
> Department of Human Services
> MAKE IT A GREAT DAY!
>
>