hql

HQL, left join on the same table

こ雲淡風輕ζ 提交于 2019-12-12 10:54:24
问题 I search a way to do a left join with the same table with hql. It's my query FROM Tvshow e LEFT JOIN Tvshow e1 ON e1.num = e.num WHERE e1.code = '024' AND e.code is not null AND e.code != '024' Hibernate don't seem to like on operator. 回答1: Left joins in HQL are only possible if you have an association between two entities. Since your query imposes the joined entity to be non null, an inner join would do the same thing. An inner join, with the join syntax, is also possible only if you have an

Hibernate ConstraintViolationException on SELECT query

大城市里の小女人 提交于 2019-12-12 10:09:39
问题 I have a Persistent Class with multi-field unique constraint on it. But defined unique constraint is not sufficient for me because on one those field non-equal but similar values are unique too. I implement a checkUniqueConstraint method. In add and update methods of DAO class, I call checkUniqueConstraint before adding or updating persist object. checkUniqueConstraint method just run a SELECT query to find object similar to input and throw a check Exception where find some ones. public class

NHibernate QueryOver with sub-query and alias

白昼怎懂夜的黑 提交于 2019-12-12 09:44:07
问题 I'm struggling to convert the following (simplified) HQL to QueryOver: select subscription from Subscription as subscription where not exists ( from Shipment as shipment where shipment.Subscription = subscription and (shipment.DeliveryDate = :deliveryDate) ) I've come this far: Subscription subscription = null; Session.QueryOver(() => subscription) .Where(Subqueries.NotExists(QueryOver.Of<Shipment>() .Where(shipment => shipment.Subscription == subscription) .And(shipment=> shipment

HQL query for id pairs / tuples

故事扮演 提交于 2019-12-12 09:43:25
问题 I am trying to query for newly created relations between two domains using HQL. So I want to do something similar to this: select x.id, y.id from Author as x join x.books as y where (x.id, y.id) not in ((1,2),(3,4)) or select x.id, y.id from Author as x join x.books as y where (x.id, y.id) not in (:existingTuples) So existingTuples are the related IDs that I already know. And I would like to see, which relations have been created. I know it's possible to do it with SQL, but with HQL I would

how to add a jar file in hive

限于喜欢 提交于 2019-12-12 09:18:52
问题 I'm trying to add hive-contrib-0.10.0.jar in hive using ADD JAR hive-contrib-0.10.0.jar command but it always saying hive-contrib-0.10.0.jar does not exist. I'm using HDP 2.1 version right now. I also added this jar file into /user/root folder using hue and run the command ADD JAR hdfs:///hive-contrib-0.10.0.jar but it giving me same error jar file doesn't exist . Is there any way to solve this problem. Where should I keep this jar file so that it will run successfully and what will be the

Hibernate_Day04

我是研究僧i 提交于 2019-12-12 09:08:19
文章目录 Hibernate_Day04 1. hibernate的检索方式 1.1 Hibernate的查询方式:OID查询 1.2 Hibernate的查询方式:对象导航检索 1.3 Hibernate的查询方式:HQL检索 1.3.1准备工作:创建数据 1.3.2:HQL简单查询 1.3.3:HQL排序查询 1.3.4:HQL条件查询 1.3.5:HQL投影查询 1.3.6:HQL分组统计查询 1.3.7:HQL分页查询 1.3.8:HQL别名查询 1.4 Hibernate的查询方式:QBC检索 1.4.1:简单查询 1.4.2:排序查询 1.4.3:分页查询 1.4.4:条件查询 1.4.5:统计查询 1.4.6:离线条件查询SSH)---DetachedCriteria 1.5 Hibernate的查询方式:SQL检索 2. hibernate的抓取策略 2.1 Hibernate的抓取策略(优化) 2.1.1延迟加载的概述 2.1.2延迟加载的分类 2.1.3抓取策略 2.1.4批量抓取 Hibernate_Day04 1. hibernate的检索方式 Hibernate提供了很多种查询方式:hibernate共提供了五种查询方式 1.1 Hibernate的查询方式:OID查询 1.2 Hibernate的查询方式:对象导航检索 1.3

org.hibernate.QueryException: JPA-style positional param was not an integral ordinal

让人想犯罪 __ 提交于 2019-12-12 07:17:16
问题 I have the following JPQL request; @Query(value = "select req_t " + "from TransactionRelation tr " + "inner join tr.requestTransaction req_t " + "inner join req_t.transactionStateHistory req_t_h " + "inner join tr.responseTransaction resp_t " + "inner join resp_t.transactionStateHistory resp_t_h " + "where req_t.id >?1 " + "and req_t.receiver.id=?2 and req_t.requestType in ?3" + "and NOT EXISTS (select t from resp_t_h t where t.transactionState = 'REPLIED' )" + "and EXISTS (select tt from req

HQL join query to join to a single row of many to one relationship

喜你入骨 提交于 2019-12-12 06:27:56
问题 This HQL query has been driving me up a wall, and I hope someone can help me out. Here is my data model: public class Record { private int id; private String name; private Set<RecordFieldData> recordFieldData; } public class RecordFieldData { private int id; private String data; private Record record; private RecordTypeField type; } public class RecordTypeField { private int id; private String dataType; } Here is some data: Record ------------------------------------------------- | id | name

what's wrong with this HQL query?

做~自己de王妃 提交于 2019-12-12 05:26:46
问题 I'm executing the following HQL query in my Grails app: def maxIndex = VirtualSubOrder.find( 'select max(vso.index) from VirtualSubOrder vso where vso.virtualOrder = ?', [virtualOrder]) The VirtualSubOrder class definitely has an (Integer) index property and a virtualOrder property. When I try to execute the query above I get the error: org.codehaus.groovy.grails.orm.hibernate.exceptions.GrailsQueryException: Invalid query [select max(vso.index) from VirtualSubOrder vso where vso.virtualOrder

HQL query returning Empty Resultset

吃可爱长大的小学妹 提交于 2019-12-12 04:21:43
问题 I have this HQL query which returns me an Empty Resultset : FROM MeetingSchedule ms JOIN FETCH ms.client JOIN FETCH ms.employees JOIN FETCH ms.parts WHERE ms.meetingId = :meetingId; If I execute SQL Query gives me result select * from meeting_schedule where meeting_id = ?; How to debug this query? What will be the cause for Empty Resultset ? PS: SQL Query is just to inform you that my MeetingSchedule is not null, I can post generated SQL Query here if you want. Thank you in advanced. 回答1: