These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Identity on inserts through SQL Server insteadof trigger
PostPosted: Tue Dec 16, 2008 3:05 pm 
Newbie

Joined: Tue Dec 16, 2008 2:38 pm
Posts: 1
I'm trying to handle an issue we're having where all of our application's inserts or updates are first going through a MS SQL Server insteadof trigger which modifies the date_created and last_updated date fields. Since this application is deployed in a clustered environment we would like to use the date from the database in case any of the servers clocks get slightly out of synch.

The problem we're having is that the identity column that comes back (generated as "native") is null.

Is there some way to employ insteadof triggers like this but still use native id generation? I'd like to keep the strategy the same to preserve the portability of the application.

thanks,
Patrick


Hibernate version: 3

Mapping documents: This is a Grails application no mapping

Name and version of the database you are using: SQL Server 2005

The generated SQL (show_sql=true):

Hibernate:
insert
into
carrier
(version, alt_id_identifier_id, APP_ID_IDENTIFIER, APP_PLAN_ID_IDENTIFIER, business_address_city, business_address_line1, business_address_line2, business_address_line3, business_address_line4, business_address_state, business_address_zip, date_created, days_app_active, db_note, edi_grouping_identifier_id, edi_map_code, fax_number, last_changed_by, last_updated, mailing_address_city, mailing_address_line1, mailing_address_line2, mailing_address_line3, mailing_address_line4, mailing_address_state, mailing_address_zip, member_id_identifier_id, name, permanent_address_city, permanent_address_line1, permanent_address_line2, permanent_address_line3, permanent_address_line4, permanent_address_state, permanent_address_zip, phone_number, provider_directory_url, tax_id, uuid)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.