MySQL With Fluent Nhibernate. "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery" when use HasMany

0

I'm using Fluent Nhibernate (v2.1.2) with MySQL (v8) in a .net core project. After mapping my class using HasMay in one of the class property I'm getting this error

NHibernate.Exceptions.GenericADOException: could not execute query [select (...Some selects here like "item1_.ItemId as col_0_0_") from Cart cart0_ left outer join Item item1_ on cart0_.CartId = item1_.CartId where cart0_.CartId in ( select cart2_.CartId from Cart cart2_ where? p0 = 1 or cart2_.Description like concat('%',? p1,'%')limit? p2,? p3)] Name : p1 - Value : True Name : p2 - Value : null Name : p3 - Value : 0 Name : p4 - Value : 100 [SQL: select (...) from Cart cart0_ left outer join Item item1_ on cart0_.CartId = item1_.CartId where cart0_.CartId in ( select cart2_.CartId from Cart cart2_ where? p0 = 1 or cart2_.Description like concat('%',? p1,'%')limit? p2,? p3)] -- -> MySql.Data.MySqlClient.MySqlException(0x80004005): This version of MySQL doesn 't yet support ' LIMIT & IN / ALL / ANY / SOME subquery '

Here is my class-map:

    public class CartMap : ClassMap<Cart>
{
    public CartMap()
    {
        Table("Cart");
        Not.LazyLoad();
        Id(x => x.Id).Column("CartId");
        // (...other properties)
        HasMany(x => x.Item).Table("Item").KeyColumn("CartId").Cascade.None();
    }
}

My tables are like:

TABLE Cart 
    CartId int(11) PRIMARY KEY AUTO_INCREMENT,
    Description varchar(500),
    (... other columns)

TABLE Item (
   ItemId int(11) PRIMARY KEY AUTO_INCREMENT,
   CartId int(11)
   (... other columns)

I think is because the Nhibernate is using "limit" to do the select, any other ways to get the same result?

mysql
.net-core
fluent-nhibernate
asked on Stack Overflow Apr 19, 2020 by Yugo Harago

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0