hql-delete

Hibernate HQL delete with and

怎甘沉沦 提交于 2020-01-01 04:04:07
问题 Hibernate doesn't delete my row: public boolean deleteVote(Login user, int pid){ Session session = getSession(); try{ String hql = "delete from Vote where uid= :uid AND pid= :pid"; Query query = session.createQuery(hql); System.out.println(user.getUid() + " and pid: " + pid); query.setString("uid", user.getUid()); query.setInteger("pid", pid); System.out.println(query.executeUpdate()); }catch(Exception e){ Outprint: uid: 123 and pid: 1 Hibernate: delete from votes where uid=? and pid=? 1 The

hibernate delete using hql

我只是一个虾纸丫 提交于 2019-12-25 04:00:11
问题 I have the following mapping in hibernate: <class name="com.foo.bulk_delete.test3.lim.bl.pom.impl.P4" table="P4_BDELETE"> <list lazy="false" fetch="select" batch-size="25" name="strings" table="L_st_49eea" > <key> <column name="f_oid$1" index="I_oid$_49eea" sql-type="char(35)"/> </key> <index column="s_idx$"/> <element type="VarcharStringType"> <column name="s_elem$_5eb03" length="512"/> </element> </list> </class> if I want to delete all P4 elements in hql i do something similar to delete

Hibernate HQL delete query

喜你入骨 提交于 2019-12-25 01:55:32
问题 Im looking for information but I didnt find how. I have two tables: Remesas |codigo_prod| nombre |codigo_proveedor| ----------------------------------------- | 1001 | product1 | EST | | 1002 | product2 | ASM | - Proveedores |codigo_proveedor| mail | ---------------------------------- | EST | pro@mail.com | | ASM | pro2@mail.com | | DAM | pro3@mail.com | I have to delete from Proveedores the row that dont have codigo_proveedor on Remesas in this case delete DAM that its not on Remesas. Thank

Why does this HQL delete fail, when an HQL select with same terms works?

一笑奈何 提交于 2019-12-06 08:32:46
问题 Why does the following HQL query fail? 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 form of query works when used in a select: string hql = @"from MyLog log where log.UtcTimestamp < :threshold and log.Configuration.Application = :application"; IList<MyLog> log = session.CreateQuery(hql)

Why does this HQL delete fail, when an HQL select with same terms works?

狂风中的少年 提交于 2019-12-04 12:08:06
Why does the following HQL query fail? 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 form of query works when used in a 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