result « Criteria « JPA Q&A

1. Getting unique result in Hibernate

how can we get distinct result by using criteria in hibernate.

2. Hibernate Result Transformer

An example entity class

public class Employee {
    Long getId();
    String getName();
    Address getAddress();  
I want to query this class using projections ...

3. Hibernate criteria results

I think this is a very simple question. but unfortunately I cannot find a solution.
I have a mysql database table called "Invoice" having "inv_No","inv_netvalue","inv_date" inv_No is the primary key. I want ...

4. [Solved] Criteria does not return correct result

Hello! I have this Criteria with conjunction: Code: public List busca(House house, BigDecimal valueMin, BigDecimal valueMax) { Criteria crit = session.createCriteria(House.class) .createAlias("address", "a"); Criterion val = Restrictions.between("value", valueMin, valueMax); Criterion room ...

5. how to flatten/unfold the Criteria result (object hierarchy)

Hello, Is there a way to tell Criteria object to return data as a flattened view (all objects/tables returned as a single row) instead of an object hierarchy? Something like this: Parent p1, Child c1 Parent p1, Child c2 Parent p1, Child c3 Parent p2, Child c1 Instead of: Parent p1 (Child c1, Child c2, Child c3) Parent p2 (Child c1) ...

6. Criteria results

I 'm testing : .......... if (a!=null){ criteria.add(Restrictions.eq("a",a); } if (b!=null){ criteria.add(Restrictions.eq("b",b); } if (c!=null){ criteria.add(Restrictions.eq("c",c); } But the result it's very strict ;becouse only return an existent object only if you fill all fields of the object. eg if I let in blank the form in the fields b,c just resturn an existent object with b,c null. How can I ...

7. apply hql to a result from criteria

8. How to make Criteria's Result as ReadOnly

9. Hibernate criteria doesn't return a result

I have a criteria for a search method, Code: Criteria criteria = session .createCriteria(PurchaseOrder.class) .add(Restrictions.eq("companyCode", code) ) ...

10. Criteria: How to get paged results & total efficiently?

Using criteria, how can one efficiently get a page of results and the total number of results. Environment is Oracle 10g if that makes any difference. If I understand the docs correctly, the usual way is to execute one query to get the page of results (with maxResults and firstResult set) and then another using a count(*) projection to get the ...

11. Criteria result set with upper case values

Hi all, I've a problem with the result sets using criteria api. The result set to be upper cased by the criteria list(). SQL query: select empid, upper(name), dept from employee where empid=1; The above query returns the result with the upper case name column. But the below query returns the exact name values from the table. Criteria query: Criteria criteria ...