3.1 trace log not writing update queries ??

Posts   
 
    
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 02-Mar-2011 22:43:42   

I do see my SELECT queries appearing in the trace log file. But whenever I save, all I see is an

Entity: Name - ObjectID : some quid And some primary key data.

I know before with the previous llbl I would see update or insert queries.

I have all those diagnostics switches set to 4.

I'm trying to troubleshoot why when I set a property value to empty string, I verify in debugger that it is "", and then save, that the save returns true, the object is refetched and the ORIGINAL string is back.

If I change the value to something else, that does stick.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Mar-2011 03:51:44   

happyfirst wrote:

I do see my SELECT queries appearing in the trace log file. But whenever I save, all I see is an

Entity: Name - ObjectID : some quid And some primary key data.

I know before with the previous llbl I would see update or insert queries.

I have all those diagnostics switches set to 4.

  • Are you sure you made changes to the Entity?
  • What LLBLGen version are you using?
  • Show us your trace configuration

happyfirst wrote:

I'm trying to troubleshoot why when I set a property value to empty string, I verify in debugger that it is "", and then save, that the save returns true, the object is refetched and the ORIGINAL string is back.

Please show us the code where you fetch and save back. Also the generated sql.

David Elizondo | LLBLGen Support Team
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 03-Mar-2011 04:09:59   

daelmo wrote:

  • Are you sure you made changes to the Entity?

I see the updated data in the database. And when I go back to the previous screen, the data is updated there as well.

daelmo wrote:

  • What LLBLGen version are you using?

3.1 - SelfServicing - SqlServer - .Net 4.0 - asp.net mvc 3

daelmo wrote:

  • Show us your trace configuration

<system.diagnostics> <switches> <add name="OracleDQE" value="4" /> <add name="ORMGeneral" value="4" /> <add name="ORMStateManagement" value="4" /> <add name="ORMPersistenceExecution" value="4" /> </switches> <trace autoflush="true" indentsize="2"> <listeners> <add name="textWriterListener" type="Utility.DateTimeTextWriterTraceListener" initializeData="f:\textWriterListener.log" traceOutputOptions="DateTime" /> </listeners> </trace> </system.diagnostics>

Ideally I'd like to configure this to just show sql statements

daelmo wrote:

Please show us the code where you fetch and save back. Also the generated sql.

I have a strongly typed generic model that I give an <entity> to and thus a property on that model that returns an instance of that entity.

In the controller save, (after some code to help persist "IsNew"), I basically just call

success=model.BusinessObject.Save();

This works great. If the object is new, primary key fields come back set, etc. If I change the value to something else, it works, the new value goes into the db and onto the screen. If I set a value to a blank field, it still returns true, the database still has the original value, the original value comes back and onto the screen.

I don't have the generated query. That's what I'm trying to get to.

Here is some sample output from the log:

02.03.2011 16:37:51.5590: Method Exit: DaoBase.ExecuteScalarQuery 02.03.2011 16:38:13.4763: Method Enter: CollectionCore.Clear 02.03.2011 16:38:13.4763: Method Exit: CollectionCore.Clear 02.03.2011 16:38:13.4763: Method Enter: DaoBase.PerformGetMultiAction 02.03.2011 16:38:13.4838: Method Enter: DaoBase.ExecuteMultiRowRetrievalQuery 02.03.2011 16:38:13.4838: Executed Sql Query: Query: SELECT [SampleDB].[dbo].[Orders].[OrderID] AS [OrderId], [SampleDB].[dbo].[Orders].[Name] FROM [SampleDB].[dbo].[Orders] WHERE ( ( [SampleDB].[dbo].[Orders].[OrderID] = @p1)) Parameter: @p1 : Int32. Length: 2. Precision: 10. Scale: 0. Direction: Input. Value: 40.

02.03.2011 16:38:13.4863: Method Enter: CollectionCore.PerformAdd 02.03.2011 16:38:13.4863: Entity to Add Description: Entity: Demo.BusinessObjects.EntityClasses.OrderEntity. ObjectID: f358280b-33dd-49dd-b9de-034251df77df PrimaryKey field: OrderId. Type: System.Int32. Value: 40 02.03.2011 16:38:13.4913: Index of added entity: 0 02.03.2011 16:38:13.4913: Method Exit: CollectionCore.PerformAdd 02.03.2011 16:38:13.4938: Method Exit: DaoBase.ExecuteMultiRowRetrievalQuery 02.03.2011 16:38:13.4938: Method Exit: DaoBase.PerformGetMultiAction 02.03.2011 16:38:13.5388: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:13.5388: Method Exit: EntityBase.CheckForRefetch: state is not OutOfSync 02.03.2011 16:38:13.5463: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:13.5463: Method Exit: EntityBase.CheckForRefetch: state is not OutOfSync 02.03.2011 16:38:36.3337: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3362: Method Exit: EntityBase.CheckForRefetch: state is not OutOfSync 02.03.2011 16:38:36.3412: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3437: Method Exit: EntityBase.CheckForRefetch: state is not OutOfSync 02.03.2011 16:38:36.3462: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3462: Method Exit: EntityBase.CheckForRefetch: already refetching or isdirty. 02.03.2011 16:38:36.3487: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3512: Method Exit: EntityBase.CheckForRefetch: already refetching or isdirty. 02.03.2011 16:38:36.3512: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3537: Method Exit: EntityBase.CheckForRefetch: already refetching or isdirty. 02.03.2011 16:38:36.3562: Method Enter: EntityBase.Save(2) 02.03.2011 16:38:36.3587: Active Entity Description: Entity: Demo.BusinessObjects.EntityClasses.OrderEntity. ObjectID: b5e8f760-e911-4df2-bc35-d8f302e50021 PrimaryKey field: OrderId. Type: System.Int32. Value: 40 02.03.2011 16:38:36.3587: Method Enter: DaoBase.PersistQueue 02.03.2011 16:38:36.3612: Persistence action info: Action: Insert. Queue length: 0 02.03.2011 16:38:36.3612: PersistQueue method result: queuePersisted result: True 02.03.2011 16:38:36.3637: Method Exit: DaoBase.PersistQueue 02.03.2011 16:38:36.3637: Method Enter: DaoBase.PersistQueue 02.03.2011 16:38:36.3637: Persistence action info: Action: Update. Queue length: 1 02.03.2011 16:38:36.3662: Current persisted entity info: Entity: Demo.BusinessObjects.EntityClasses.OrderEntity. ObjectID: b5e8f760-e911-4df2-bc35-d8f302e50021 PrimaryKey field: OrderId. Type: System.Int32. Value: 40 02.03.2011 16:38:36.3662: Method Enter: DaoBase.UpdateExisting(3) 02.03.2011 16:38:36.3662: Method Enter: DaoBase.ExecuteActionQuery 02.03.2011 16:38:36.3687: Query Execution Result: 1 02.03.2011 16:38:36.3687: Method Exit: DaoBase.ExecuteActionQuery 02.03.2011 16:38:36.3712: Query Execution Result: True 02.03.2011 16:38:36.3712: Method Exit: DaoBase.UpdateExisting(3) 02.03.2011 16:38:36.3737: PersistQueue method result: queuePersisted result: True 02.03.2011 16:38:36.3762: Method Exit: DaoBase.PersistQueue 02.03.2011 16:38:36.3762: Method Exit: EntityBase.Save(2) 02.03.2011 16:38:36.3812: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3812: Method Enter: EntityBase.CheckForRefetch 02.03.2011 16:38:36.3837: Method Exit: EntityBase.CheckForRefetch: already refetching or isdirty. 02.03.2011 16:38:36.3912: Method Enter: DaoBase.PerformFetchEntityAction 02.03.2011 16:38:36.3937: Method Enter: DaoBase.ExecuteSingleRowRetrievalQuery 02.03.2011 16:38:36.3962: Executed Sql Query: Query: SELECT [SampleDB].[dbo].[Orders].[OrderID] AS [OrderId], [SampleDB].[dbo].[Orders].[Name] FROM [SampleDB].[dbo].[Orders] WHERE ( ( [SampleDB].[dbo].[Orders].[OrderID] = @p1)) Parameter: @p1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 40.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 03-Mar-2011 10:12:09   

If I change the value to something else, it works, the new value goes into the db and onto the screen. If I set a value to a blank field, it still returns true, the database still has the original value, the original value comes back and onto the screen.

So when you set a field to balnk, that the only case when there is no SQL written, right?

Do you fetch the entity first before updating it? Would you please post the code which sets it to blank? If the field is not changed then no SQL will be generated.

happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 03-Mar-2011 13:51:07   

ok, scratch this whole post. Very wierd.

I regenerated because I had added other fields elsewhere and now the problem has gone away.

I CAN now save blank values into the db and now I see update queries in the log.

Wierd......

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Mar-2011 06:05:32   

It has an explanation for sure. We would need more info to know that. Anyway glad you sorted it out wink

David Elizondo | LLBLGen Support Team