Hi Otis,
sorry, indeed ChatGPT was wrong. I removed the bad statement to avoid it being found by some other AI or human..
To answer your question about prefetching the Month entity: no, I don't do that. I did add it to the prefetch path just as a test, but this did not change anything.
I did as requested and tried creating a repro project with only the entities and tables required to reproduce the bug. As often, I was not able to reproduce the issue at first.
Finally, I noticed that the following piece of code is required to produce the behavior:
Private Sub InitClassEmpty(validator As IValidator, fields As IEntityFields2)
OnInitializing()
If fields Is Nothing Then
Me.Fields = CreateFields()
Else
Me.Fields = fields
End If
Me.Validator = validator
InitClassMembers()
' __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
Me.TFirm_StartMonat = 1
' __LLBLGENPRO_USER_CODE_REGION_END
OnInitialized()
End Sub
The line Me.TFirm_StartMonat = 1 was added to enable us to save an empty entity without having to explicitly set the value of TFirm_StartMonat.
This is to emulate the default constraint on the column. Maybe there is another way to achieve this. I attached two screenhots above. One shows that the field does have a default constraint. The other shows the entity field, where there is no mention of a default value.
Maybe this is sufficient for you, otherwise, I will have to create the sample project as requested.
Thanks,
andreas