Why does this HQL query fail when choosing HQL with the same terms?

Why is the following HQL query executed?

string hql = @"delete MyLog log
               where
                    log.UtcTimestamp < :threshold and
                    log.Configuration.Application = :application";

session.CreateQuery(hql)
       .SetDateTime("threshold", threshold)
       .SetEnum("application", this.application)
       .ExecuteUpdate();

The same request form works when used in select:

string hql = @"from MyLog log
               where
                    log.UtcTimestamp < :threshold and
                    log.Configuration.Application = :application";
IList<MyLog> log = session.CreateQuery(hql)
    .SetDateTime("threshold", threshold)
    .SetEnum("application", this.application)
    .List<MyLog>();

The mapping for MyLog contains:

References(x => x.Configuration)
     .Columns("CONFIGURATION_ID")
     .ReadOnly();      

The configuration display contains:

Map(x => x.Application, "APPLICATION_ID");

The error I get is:

remove from MYLOG CONFIGURATION countercon1_, where UTC_TIMESTAMP <: p0 and APPLICATION_ID =: p1 ;: p0 = 10/04/2010 17:15:52 ,: p1 = 7

NHibernate.Exceptions.GenericADOException: Failed to execute update request [SQL:

remove from MYLOG CONFIGURATION countercon1_, where UTC_TIMESTAMP <? as well as APPLICATION_ID =?

] ---> Oracle.DataAccess.Client.OracleException: ORA-00933: SQL command ended incorrectly

+3
3

:

delete MyLog log
where log.id in
          (select l.id
           from MyLog l
           where l.UtcTimestamp < :threshold and
           and.Configuration.Application = :application)
+5

DELETE FROM MyLog ....

, HQL delete , (n) .

, .

+2

Source: https://habr.com/ru/post/1768049/


All Articles