hql

Hive - Varchar vs String , Is there any advantage if the storage format is Parquet file format

寵の児 提交于 2019-12-10 14:48:44
问题 I have a HIVE table which will hold billions of records, its a time-series data so the partition is per minute. Per minute we will have around 1 million records. I have few fields in my table, VIN number (17 chars), Status (2 chars) ... etc So my question is during the table creation if I choose to use Varchar(X) vs String, is there any storage or performance problem, Few limitation of varchar are https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-string

Composite key, in comparison

陌路散爱 提交于 2019-12-10 14:46:34
问题 I have three fields that form a unique composite key on a table. I want to pass in 3 different arrays, where the index matches. custIds= [0,1,2] custLetters = [A,B,C] products = ["Cheese","lemons","Aubergine"] is there one sql statement that will return all three rows (assuming they exists), just combining via in won't work to due to "false positives" : select * from mytable where custId in (custIds) and custLetters in (custLetters) and product in (products); database oracle, but via

NHibernate HQL SELECT TOP in sub query

不打扰是莪最后的温柔 提交于 2019-12-10 14:11:36
问题 Is there a way of using SetMaxResult() on a sub query? Im writing a query to return all the order items belonging to the most recent order. So I need to limit the number of records on the sub query. The equivalent sql looks something like: SELECT i.* FROM tbl_Orders o JOIN tbl_OrderItems i on i.OrderId = o.Id WHERE o.Id in (SELECT TOP 1 o.Id FROM tbl_Orders o orderby o.Date desc) Im using hql specifically because criteria api doesnt let you project another domain object (Im querying on orders

Using Min, Max and Count on HQL

ⅰ亾dé卋堺 提交于 2019-12-10 13:32:32
问题 Does hibernate HQL queries support using select min, max, count and other sql functions? like: select min(p.age) from person p Thanks 回答1: Yes, min() , max() and count() are supported in HQL. see aggregate functions in the Hibernate Doc. 回答2: thats how I am using max in Hibernate : public long getNextId(){ long appId; try{ Session session = HibernateUtil.getAdmSessionFactory().getCurrentSession(); Transaction t = session.beginTransaction(); String sequel = "Select max(JAdmAppExemptionId) from

Query to delete all rows in a table hibernate

☆樱花仙子☆ 提交于 2019-12-10 13:06:26
问题 I am trying to delete all rows in table 'user_role' with hibernate query. But every time i am getting errors. Can someone please help me with it. DaoImpl @Override public void deleteAll() { session.getCurrentSession().delete(/*delete all query*/); } model class @Entity @Table(name="user_role") public class User_Role { @Id @Column @GeneratedValue(strategy=GenerationType.AUTO) private int id; @Column(name="role_name") private String name; //setter and getter } 回答1: try this: sessionFactory

HQL and Hibernate Criteria with Having and GROUP BY clause

爱⌒轻易说出口 提交于 2019-12-10 12:29:03
问题 I have Problem when I executing the following Hibernate HQL Query: String hql = "from ProcessInstanceHistory where processInstance.processInstanceId=122 group by newStatusId having max(processModifiedDate)"; Query query = session.createQuery(hql); List qResult = query.list(); ProcessInstanceHistory processInstanceHistory = (ProcessInstanceHistory) qResult.get(0); It gives me Following error when I run above script without HAVING clause: org.hibernate.exception.SQLGrammarException: could not

convert from SQL to HQL gives error Grails

Deadly 提交于 2019-12-10 12:25:15
问题 I am trying to convert this sql to hql to fetch the data from artifact table. I have this sql query which works fine on the database select a.* from classification c join (select id from taxonomy_node start with id = 5067 connect by nocycle prior id = parent_id) h on (c.node_id = h.id) join artifact a on (a.id = c.artifact_id) Where a.DOCUMENT_ID = 10462 AND c.active=1 I am trying to convert it to HQL artifacts = Artifact.executeQuery("FROM classification c "+ "JOIN (SELECT id FROM taxonomy

How this SQL Query in hbm.xml file can be written in source code?

那年仲夏 提交于 2019-12-10 12:18:33
问题 I am trying to run a SQL query in Hibernate. I am using its documentation. Because of some unknown values i am trying to do inside the Source code. See this below SQL-Query configuration. How to re-write it in source code itself!! I tried this personList = session.createSQLQuery("SELECT person.NAME, person.AGE, person.SEX, address.STREET, address.CITY, address.STATE, address.ZIP FROM person JOIN address WHERE person.ID = address.PERSON_ID").addEntity(Person.class).addEntity(Address.class)

How to fetch data dynamically from two tables using HQL (Annotations)? I'm posting the details

不打扰是莪最后的温柔 提交于 2019-12-10 11:47:46
问题 I have two tables called STUDENT(studentId,studentName,courseId) , COURSE(courseId,courseName) in mysql.I have two .java files for mentioned tables as: Student.java package com.vaannila.course; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.*; @Entity @Table(name="STUDENT") public class Student { private long courseId; private String

Hibernate entity only one column, no name

让人想犯罪 __ 提交于 2019-12-10 11:41:01
问题 I want to map one column, without using a column name. I am using a count entity, and the want to use mulple different queries with the same entity : @Entity public class CountDTO extends Number { @Id // below causes an error in my test, hsql not same syntax @Column(name = 'COUNT') private Long count; In my prod (oracle) database I can just do select count() as COUNT from ... however, the same syntax doesn't work using hypersql in-memory db ? Is their an oracle/hsql compatible way to map a