constructor « Query « JPA Q&A





1. SELECT NEW() with many-to-one collection inside the constructor - HQL    stackoverflow.com

I don't seem to find an answer to somthing that i refuse to accept as "Not Possible" :) Here is my HQL query: "SELECT new TestTable(t.id,t.param1,t.param2,t.param3,stps) FROM TestTable t left join t.steps ...

2. NHibernate HQL: How to use the new object constructor with 'distinct'?    stackoverflow.com

I need to use the HQL object constructor feature, e.g:

select new SomeClass(i.Id, i.Name) from Item i...
But I also need to use the distinct keyword, as there are joins further down in ...

3. NHibernate returning duplicate rows from hql named query with object constructors    stackoverflow.com

I have a named hql query which makes use of object constructors for an object that is not mapped (it is only imported) e.g.

select distinct new NotMappedResultClass(ah.SomeProp1, ah.SomeProp2)
from SomeMappedClass
where ...
order by ah.SomeProp1
The ...

4. JPA 2.0: How to avoid full class name in `SELECT NEW full.class.Name`?    stackoverflow.com

How can I avoid putting FQCN into SELECT NEW ...? Packages are often changed during refactoring, and that may cause troubles. Not sure if I can do something for that in JPA; ...

5. Lucene: Cannot find symbol    stackoverflow.com

I am using Lucene 3.4.0, hibernate (hibernate-all.jar), ANT and TestNG to run some test... Most of all works right now, but since I have implemented my lucene part nothing seems to work ...

6. JPA 2 case statement allow null in constructor query    stackoverflow.com

I have a constructor criteria query. For the constructor, I'm attempting to do something like this:

query.select( builder.construct( MyView.class
    , metaObject
    , builder.selectCase( builder.isNull( metaOtherObject ...

7. "select new Constructor" in HQL    coderanch.com

8. select new constructor in JPA/Hibernate    coderanch.com

Hello, I have something like this: List users= (List) entityManager.createQuery("select new com.object.User(...) ..."); This works without problems, when I run the application. But in Eclipse the just-in-time-compiler/debugger tells me an ERROR: Multiple markers at this line - Unable to locate class [com.object.User] [select new ccom.object.User(...)...] - Type safety: Unchecked cast from List to List I guess, the compiler complains it, because ...





10. SELECT NEW() with a collection inside the constructor HQL    forum.hibernate.org

Hi all, I don't seem to find an answer to somthing that i refuse to accept as "Not Possible" :) Here is my HQL query: "SELECT new TestTable(t.id,t.param1,t.param2,t.param3,stps) FROM TestTable t left join t.steps as stps WHERE t.someObj.id IN (:someObjIds)" TestTable has the following consturtor: public TestTable(Integer param1, Integer param2,Date param3,Date param4, Set steps) i have tried to use Collection in ...

11. JPQL query new operator. Unable to find Constructor.    forum.hibernate.org

Hello, I am trying to test some JPQL queries from Hibernate Console (I hope to see same results when executing the same query onces the application had been deployed). I am using "Hibernate Tools for Eclipse Version: 3.4.0.v20110215-1252-H31-GA". The underlying database is Postgres 9. I am using Java 6 version. Entity specification is using JPA annotations. I have execute severals JPQL ...

12. HQL Select Clause and constructor    forum.hibernate.org

I am using 2.1.3 and have a question about using new in an HQL select. My NameDTO is not mapped which is what I want. Is it possible to use the NameDTO constructor without the NameDTO package name (refapp.NameDTO)? I have been searching the forum half the day and can't find an answer. This has got to be a really common ...

14. Subqueries in hql constructors    forum.hibernate.org

15. Using constants in select new constructor    forum.hibernate.org

16. Unable to find constructor when using new class and count(*)    forum.hibernate.org

What type is returned form HQL query using count(*). This worked in Hibernate 2 versions and I've recently upgraded to 3 and noticed this no longer works. When using a query that is using the syntax select new com.foo.Bah(f.name, count(*)) from Foo Where condition = condition grouby something Bah old working constructors don't seem to be recognised anymore which makes me ...





17. Order by a subselected column with constructor    forum.hibernate.org

Hibernate version: 3.1.3 Name and version of the database you are using: Oracle 10.2.0.2 In an HQL query using a constructor (select new MyObject), is it possible to order by a column that is mentioned in the constructor only as a subselect? I have a class Customer with two attributes: String name and List comMedia. But I only want to select ...