criteria « Column « JPA Q&A





1. How to return an entity with chosen columns using Criteria    stackoverflow.com

I'm really new with Hibernate. I want a List<User> using hibernate criteria, but only with fields User id and name filled up. Is that possible? Something like the query shown below:

SELECT ...

2. Hibernate Criteria unique result (column other than key)    stackoverflow.com

I'm currently using a Hibernate Criteria to return a list of results (filtering on various column values), but several of the objects have the same value for one of the attributes ...

3. Calculating rank on an aggregate column in a Hibernate SQLProjection    stackoverflow.com

I am trying to write a query to calculate a rank column based upon an aggregate column. The query is an SQLProjection as part of a Hibernate Criteria query. Here is ...

4. Using database functions to transform columns in hibernate criteria    stackoverflow.com

Despite 3 hours of googling and searching the API I can't find any reference to whether it's possible to use database functions within a hibernate criteria query. To be specific: I'd ...

5. advanced Hibernate Criteria API, 3 joins + new column....    forum.hibernate.org

hmmm, I guess that is not really a join, but I wasn't thinking yesterday. It is really a subselect in the from clause to narrow the results of the table generated by the first select statement. Is there a way to do that in criteria api? Is there extension points in the api?

6. criteria api table join missing = unknown column    forum.hibernate.org

I have a many to many relationship of doctors to specialties, where the join table includes a registration date for that specialty. I am trying to use the Criteria API to return all doctors who have a specialty description matching a like clause. I have tried various combinations of criteria, subcriteria and aliases, but cannot make it work. The generated SQL ...

8. criteria.setProjection can cause "column not exist" problems    forum.hibernate.org

If there is a table "Entity" and you want to return only the name and ID fields(criteria.setProjection( fields) but ID is in a condition in search criteria ( Restrictions.eq("id", XXXXXX )) then hibernate generates this criteria: select this_.NAME as y0_, this_.ID as y1_ from Entity this_ where y1_=? Either removing the search condition(restrictions) or removing from the project fields(i.e no ...

9. Criteria Or, ilike on Joined Columns    forum.hibernate.org





10. Hibernate Criteria concatenate columns    forum.hibernate.org

11. ambiguous column name with criteria api and maxresults    forum.hibernate.org

The criteria api is generating ambiguous column names which prevents setMaxResults from working this is the pertinent sql that is generated Code: select * from ( this.id as id3_, dealcommen1_.id as id__, ...

12. criteria API, "invalid column name" & 2 obj. w    forum.hibernate.org

14. Table and column names in Criterias    forum.hibernate.org

You are right, it should be implemented as a template. My question was actualy if it is planned to be implemented directly in hibernate? I think it will be quite easy to generate for each table/class mapping an Interface that will consist in string constants representing the table and culumn names. Sergiu

15. ConcatenatorProjection concatenates columns using Criteria    forum.hibernate.org

Hibernate version:3.1.2 Hello, We have a table PEOPLE with 2 COLUMNS: XNAME, YNAME XNAME is SET and YNAME is EMPTY OR YNAME is SET and XNAME is EMPTY Forces: We have to order them by NAME ASC, my idea is to create a specific Projection to do the concatenation, i.e. ORDER BY CONCAT(XNAME,YNAME) We have to use Criteria API. So I ...





17. How to give rtrim to a column name in a hibernate criteria    forum.hibernate.org

Hi, I want to write a Query using hibernte criteria as follows: select * from where rtrim(ColumnName) like '123'; But in criteria i don't know how to give ltrim(rtrim(columnName). Can anyone help in this? As the column is of type Char it is not working on DB side if i give simply 'like'. I need to give "rtrim(columnName) like' to ...

18. Criteria API - Using sqlRestriction with join table column    forum.hibernate.org

String likeValue = "%Fritz%"; List persons = sess.createCriteria(Person.class, "p") .createAlias("p.company", "c") .add(Restrictions.or( Restrictions.like("c.companyName", likeValue), ...

19. Criteria based on column name not property name    forum.hibernate.org

20. Criteria operations on table's columns    forum.hibernate.org

I have the following table: TABLE ID Integer, IMPORTO Integer, RESIDUO Integer which is mapped (from Bean) with MyClass: MyClass{ Integer Id Integer a Integer b } I need to execute the following query (using CRITERIA API): SELECT FROM TABLE WHERE IMPORTO - RESIDUO < 10; which becomes Criteria criteria = session.createCriteria(MyClass.class); criteria.add(Restrictions.lt("a", b + 10"); criteria.list(); but i receive this ...