nhibernate « Data Type « JPA Q&A

1. Getting DATEPART in HQL or Criteria?    stackoverflow.com

How can i get DATEPART of a time using HQL or Criteria ? I have googled it up and get some tips, but wasn't enough. If there is someone who has experienced it ...

2. NHibernate HQL's Equivalent to T-SQL's TOP Keyword    stackoverflow.com

What is NHibernate HQL's Equivalent to T-SQL's TOP Keyword? Also what is the non-HQL way for saying give me the first 15 of a class?

3. Enum tables in Hibernate/NHibernate    stackoverflow.com

We are using NHibernate, and one of the common patterns we have for storing enum-like information is to define separate tables for the enum, and just make a reference to the ...

4. Will hql give you compile time errors?    stackoverflow.com

Will hql give you compile time errors like criteria query? I remember hearing that one of the methods doesn't (besides raw SQL).

5. What is the HQL equivalent of this SQL    stackoverflow.com

Trying to do a bit more complex query, and thought that HQL would be better for the job. Using nHibernate.

SELECT * FROM [Group] g 
  INNER JOIN [User2Group] ug ...

6. What is the HQL equivalent of this SQL?    stackoverflow.com

FROM [Group] g
INNER JOIN User2Group ug
    **on g.Id != ug.GroupId**
INNER JOIN [Activity] a
    on a.Id = g.ActivityId
WHERE g.UserId != 2
AND a.Lineage like '0,1,%'
Group > ...

7. HQL 'parsename' equivalent    stackoverflow.com

I've discovered PARSENAME function as a good choice to order IP address stored in Database. Here there is an example.
My issue is I'm using Hibernate with named queries in ...

8. HQL equivalent of CreateCriteria(string)    stackoverflow.com

Short version: is there a HQL equivalent for session.CreateCriteria(string)? Long version: The mapping looks like this:

<class name="MyClass" entity-name="MyClass">
<class name="MyClass" entity-name="SomeEntityName">
When I use session.CreateCriteria("SomeEntityName"), only objects stored in "SomeEntityName" ...

9. In hibernate how do I always use db server's timestamp?    stackoverflow.com

I would like to add db server's timestamp in last_update column of my table. How can I achieve this in hibernate? Thanks

10. How to use MySql date_add in Nhibernate?    stackoverflow.com

This really puzzled for hours, I searched all over the internet, but got no working solution. Can someone point where the problem is ... thanks ! I created my own dialect class

public ...

11. Compare term to current date in HQL (with .Net)    stackoverflow.com

I want to compare a column value to the current date, using HQL. I tried

IQuery someQuery = session.CreateQuery(String.Format(
            @"Select s.Id

12. Is there a HQL equivalent to datediff for NHibernate?    stackoverflow.com

I haven't found a clear answer but I would like to grab any values from within the past 24 hours. I have an alternative solution in code but I would like ...

13. Fluent Hibernate Automapping issues in table definition (all indices not null)    stackoverflow.com

Title: multiple class with same variable name list has issues in table definition (all indices not null) lets say i have two class implementing from one interface

public interface IInterface1
   IList<string> ...

14. NHibernate Delete with date arithmatic using HQL    stackoverflow.com

I've looked around and can't find too much. But is it possible to do something like this using HQL in nHibernate: Session.CreateQuery(@"DELETE FROM MyObject mo ...

15. using HQL to concatenate strings from multiple rows    stackoverflow.com

Consider a table holding names, with three rows: Peter Paul Mary using NHibernate HQL I want to retrieve all the names as a single string "Peter, Paul, Mary" to put it inside a ...

16. How to use ROW_NUMBER() in HQL?    stackoverflow.com

My databse is MS SQL. I want to use ROW_NUMBER() in HQL. Is it possible? How? I know about Custom Functions. But prefer a way that does not need ...

17. Show data between a date range    stackoverflow.com

Greetings I have the personal data of an individual including birth date How do I get the information of people born between the date 1 and date 2? date of birth is in a ...