You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just updated from NHibernate 5.2.7 to 5.3.2 and now a few of my tests are failing. Some of them all have the same error where Oracle reports inconsistent datatypes for a parameter.
It looks like the affected Linq queries all pass the entities directly as a parameter, so NHibernate is responsible for extracting the Id from the object. This doesn't work any more in 5.3.x when the entity parameter type is XyzProxyForFieldInterceptor (which I think is the case if an entity with a lazy property or lazy component is loaded).
Example query:
// Person is mapped with a lazy component
Person personParameter = session.Get<Person>(123);
// Fails with Oracle error "inconsistent datatypes"
var result = Query<Customer>()
.Where(x => x.Persons.Contains(personParameter))
.ToArray();
The exception message contains the information Name:p1 - Value:{PersonProxyForFieldInterceptor}.
The SQL log output confirms the wrong parameter by showing something like this: :p0 = 0x0001000000FF... [Type: Object (0:0:0)]
If I change the query so that a just persisted object is used as a parameter (which isn't of type PersonProxyForFieldInterceptor but instead just of type Person) the query works correctly.
The text was updated successfully, but these errors were encountered:
fredericDelaporte
changed the title
[5.3.x regression] Entity objects of type XyzProxyForFieldInterceptor are not correctly passed as parameters to Linq queries
Entity with field interceptor are not correctly passed as Linq parameters
Sep 6, 2020
I've just updated from NHibernate 5.2.7 to 5.3.2 and now a few of my tests are failing. Some of them all have the same error where Oracle reports inconsistent datatypes for a parameter.
It looks like the affected Linq queries all pass the entities directly as a parameter, so NHibernate is responsible for extracting the Id from the object. This doesn't work any more in 5.3.x when the entity parameter type is
XyzProxyForFieldInterceptor
(which I think is the case if an entity with a lazy property or lazy component is loaded).Example query:
The exception message contains the information
Name:p1 - Value:{PersonProxyForFieldInterceptor}
.The SQL log output confirms the wrong parameter by showing something like this:
:p0 = 0x0001000000FF... [Type: Object (0:0:0)]
If I change the query so that a just persisted object is used as a parameter (which isn't of type
PersonProxyForFieldInterceptor
but instead just of typePerson
) the query works correctly.The text was updated successfully, but these errors were encountered: