Hibernate criteria Boolean value not working on child
I am working on Hibernate criteria query which having parent-child one-to-many relationship. I am fetching parent records from DB where I do not want the deleted child records to be fetched along with the parent records. To apply deleted restriction on the child I have used,
criteria.createAlias("childsList", "child");
and
criteria.add(Restrictions.eq("child.deleted", false));
The problem is in resultset I am getting even the deleted records of the child. However, if I use the query generated by hibernate logs and run that query in Mysql workbench then it gives proper results by excluding the deleted child records.
I am using MySQL DB on RDS. I have tried column values as Boolean in Java and Tinyint in MySQL (as MySQL maps Boolean to Tinyint ) and also tried using the bit in MySQL . Nothing worked.
Any leads will be appreciated. Thanks in advance!
链接地址: http://www.djcxy.com/p/37128.html