|
Hello Hibernate Experts,
i would very much appreciate your help in transforming the following SQL statement to a valid HQL Statement. I tried for hours but was not successfull:
SELECT * FROM master as m left outer join (select * from child as c where ...
Started by Markus on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Insert the SQL that correspond to your subrequest..
That formulas take SQL, not HQL.
|
|
Is there a way to create a Distinct query in HQL. Either by using the "distinct" keyword or some other method. I am not sure if distinct is a valid keywork for HQL, but I am looking for the HQL equivalent of the SQL keyword "distinct".
Started by Mike Pone on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you....
(Names have been changed to protect identities)
String[] {startDate, endDate, bar});
It's worth noting that the "distinct" keyword in HQL does not map directly to the "distinct" keyword in SQL.
Here's a snippet of hql that we use.
|
|
If I write in HQL
A between 5 and 10
is that equivalent to
A >= 5 and A <= 10
or
A > 5 and A < 10
or some other of the 4 combinations?
Started by flybywire on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
So between in HQL is also.
In HQL is translated to the between operator in SQL, which is inclusive.
|
Ask your Facebook Friends
|
Where can I find a list of all HQL keywords?
Started by flybywire on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Try this ...not sure if it's complete or exact, but it may be, as it's a list of HQL tokens.
|
|
What is the recommended way to truncate a table using hibernate/hql?
I've tried this:
Query query = session.createQuery("truncate table MyTable"); query.executeUpdate();
But it didn't work (truncate doesn't seem do be documented anywhere in hql...)
Answer Snippets (Read the full thread at stackoverflow):
Works great:
public abstract class(); int rowsAffected = 0; try {... .
I used the delete syntax in an HQL to maintain portability.
String hql = String.format("delete from %s",myTable); Query query = session.createQuery(hql) return.
|
|
Suppose that I have the following HQL:
String hql = "select e.aField from MyEntity as e";
If I want to refactor and change the name of the MyEntity 's member variable aField to something else, I also have to change all occurrences in the whole code in...
Started by nimcap on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Create an enum of all....
Use NHibernateToLinq 3.
Use Criteria instead of HQL 2.
Options: 1.
You can used NamedQueries - you put your HQL as value in hql you wont be able to start your WebApp.
Every use and manages the change for me.
|
|
I need to create an HQL where clause which has the form:
where tbl1.DateTimeField + tbl2.TimeSpanField >= :someDateTimeParameter
The DateTimeField is of type DateTime
The TimeSpanField is of type BigInt (is this the best option?)
The someDateTimeParameter...
Started by Andrew Bullock on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
For 1 and 2 see http://stackoverflow.com/questions/639522/performing-date-time-math-in-hql.
|
|
What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/build than HQL.
When do you use Criteria and when HQL?...
Started by cretzel on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Criteria is an object-oriented API, while....
For different join types.
Also, HQL is a bit more powerful, I think, e.g.
On the other hand I'm using HQL for static and complex queries, because it's much easier to understand/read HQL.
|
|
Hello there. Does hibernate HQL queries support using select min, max, count and other sql functions?
like
select min(p.age) from person p
Thanks
Started by Danmaxis on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Are supported in HQL.
|
|
I'd like to "dry-run" Hibernate HQL queries. That is I'd like to know what actual SQL queries Hibernate will execute from given HQL query without actually executing the HQL query against real database.
I have access to hibernate mapping for tables, the...
Started by Juha Syrjälä on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
For HQL, it's the same concept - you have to cast to Hibernate with a the 3.2-3.3 versions of Hibernate....
Update: for an offline, dry-run of some HQL, using HQLQueryPlan at this answer for Criteria Queries.
There has to be a better approach.
|