Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > General> Error when saving collection async (Cache)
 

Pages: 1
General
Error when saving collection async (Cache)
Page:1/1 

  Print all messages in this thread  
Poster Message
Vestas
User



Location:
Denmark
Joined on:
27-Jun-2008 07:17:38
Posted:
6 posts
# Posted on: 11-Mar-2010 11:06:21.  
We have a problem when trying to save a EntityCollection to the DB.
Our page use a async button to update a collection of 'order line' entities with serial numbers. Theis sn are in another table in the db and binded to the OrderLine as a relation.
In our test we have three orderlines, we fill the serialno for all three, the one with a sn we know exist in the db.
We now get an exception and this is fine.
We now change sn to one we know do not exist in the db.
Here our problem starts. We get this exception:

An exception was caught during the execution of an action query: Violation of UNIQUE KEY constraint 'UN_Serial_Number'. Cannot insert duplicate key in object 'dbo.Serial'. The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.    

When we debug the collection right before the save method "DataAccessAdapter.SaveEntityCollection(collection, False, recurse)", we get the collection to contain the right three entities with the right three SN.
But in the output window in VS2008 we get the LLBL generated SQL to try to insert the collections bindings more then one time:

Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: CreateInsertDQ
Method Enter: CreateSingleTargetInsertDQ
Generated Sql query:
    Query: INSERT INTO [ComponentDoc].[dbo].[Serial] ([Number], [CreatedById], [ChangedById]) VALUES (@Number, @CreatedById, @ChangedById);SELECT @Id=SCOPE_IDENTITY()
    Parameter: @Id : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Output. Value: <undefined value>.
    Parameter: @Number : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "jewes10".
    Parameter: @CreatedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.
    Parameter: @ChangedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.


Method Exit: CreateSingleTargetInsertDQ
Method Exit: CreateInsertDQ
Method Enter: CreateInsertDQ
Method Enter: CreateSingleTargetInsertDQ
Generated Sql query:
    Query: INSERT INTO [ComponentDoc].[dbo].[Serial] ([Number], [CreatedById], [ChangedById]) VALUES (@Number, @CreatedById, @ChangedById);SELECT @Id=SCOPE_IDENTITY()
    Parameter: @Id : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Output. Value: <undefined value>.
    Parameter: @Number : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "jewes08".
    Parameter: @CreatedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.
    Parameter: @ChangedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.


Method Exit: CreateSingleTargetInsertDQ
Method Exit: CreateInsertDQ
Method Enter: CreateInsertDQ
Method Enter: CreateSingleTargetInsertDQ
Generated Sql query:
    Query: INSERT INTO [ComponentDoc].[dbo].[Serial] ([Number], [CreatedById], [ChangedById]) VALUES (@Number, @CreatedById, @ChangedById);SELECT @Id=SCOPE_IDENTITY()
    Parameter: @Id : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Output. Value: <undefined value>.
    Parameter: @Number : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "jewes09".
    Parameter: @CreatedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.
    Parameter: @ChangedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.


Method Exit: CreateSingleTargetInsertDQ
Method Exit: CreateInsertDQ
Method Enter: CreateInsertDQ
Method Enter: CreateSingleTargetInsertDQ
Generated Sql query:
    Query: INSERT INTO [ComponentDoc].[dbo].[Serial] ([Number], [CreatedById], [ChangedById]) VALUES (@Number, @CreatedById, @ChangedById);SELECT @Id=SCOPE_IDENTITY()
    Parameter: @Id : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Output. Value: <undefined value>.
    Parameter: @Number : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "jewes08".
    Parameter: @CreatedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.
    Parameter: @ChangedById : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 34888.


Method Exit: CreateSingleTargetInsertDQ
Method Exit: CreateInsertDQ
A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.DLL
The thread '<No Name>' (0x650) has exited with code 0 (0x0).

We have an idea, that this have to do with the async call and cache. But we do not know what to do. Cound anyone please advice.
  Top
Walaa
Support Team



Location:
Egypt
Joined on:
21-Aug-2005 16:03:48
Posted:
9817 posts
# Posted on: 11-Mar-2010 11:41:56.  
Could you please post some code snippets.

LLBLGen Training
http://www.linkedin.com/in/walaa
 
Top
Vestas
User



Location:
Denmark
Joined on:
27-Jun-2008 07:17:38
Posted:
6 posts
# Posted on: 11-Mar-2010 12:59:59.  
I'll love to put in some code, but it is prety complexed.

What I'll like to try is to either remove caching or cleaning the cache before im saving the collection. But im not quit sure how to do that.
  Top
MTrinder
Support Team



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
994 posts
# Posted on: 11-Mar-2010 21:09:59.  
Which cache do you mean ?

Matt


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.