Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to configure buildSelectQueryForIdentity()


Pavel Zelenka wrote:
> 
> The new IDENTITY values are obtained via SELECT @@IDENTITY. But I need to
> change it to SELECT SCOPE_IDENTITY() because of triggers in database.

Hi Pavel Zelenka,

Did you find any solution for that? I'm facing the same problem in a
replicated SQL Server database where triggers are added on client-side. I
made exactly the same changes as you did and get also the exception "Error
preallocating sequence numbers.  The sequence table information is not
complete."

I figured out that the query "SELECT SCOPE_IDENTITY()" returns a NULL-value.
It seems that this query is executed in another scope than the
insert-statement.

Is there maybe a way to use "SELECT IDENT_CURRENT('tablename')" in
eclipselink? But i'm not sure how to pass the tablename parameter to
eclipselink...

Here is a link to MSDN library which explains the problem when using
@@IDENTITY in replicated environements:
http://msdn.microsoft.com/en-us/library/ms190315(SQL.90).aspx (see "B. Using
@@IDENTITY and SCOPE_IDENTITY() with replication")

Thanks in advance.

Greetings,
Christophe

-- 
View this message in context: http://www.nabble.com/How-to-configure-buildSelectQueryForIdentity%28%29-tp22896837p25149765.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top