object « Criteria « JPA Q&A





1. Hibernate, return custom object with Criteria or HQL    stackoverflow.com

there is a way to return a custom object with a criteria query or hql query? For example, i have a class MyClass with a constructor MyClass(int id, String text), i want ...

2. Hibernate Criteria for assotiated objects    stackoverflow.com

I have the next structure of DTO objects:

public class MainDTO implements Serializable {
    private Long mainId;
    private String name;
    ... //some other ...

4. AND/OR in Hibernate - Criteria object    coderanch.com

I have a query like "select this_.appNum as y0_ from CoreApplication this_ inner join LoanAndDeposit loananddep2_ on this_.appNum=loananddep2_.CoreApplication_appNum inner join OptionTrade optiontrad1_ on this_.appNum=optiontrad1_.CoreApplication_appNum where this_.applicationType in ( ?, ?, ?, ? ) and this_.status in ( ?, ?, ? ) and optiontrad1_.lastModifiedUser=? and loananddep2_.status=? ". For the last part i.e. OptionTrade.lastModifiedUser and LoanAndDeposit.status I have to do an OR and ...

5. Cretae Criteria is not working for inner objects in NHiberna    forum.hibernate.org

Hi, I have Region and City entities like this, namespace HelloNHibernate { [Serializable] public class Region { public int id; public string name; public IList cities { get; set; } } [Serializable] public class City { public int cityid; public string cityname; } } My hbm.xml file look like, ...

6. Hibernate criteria to return more objects    forum.hibernate.org

Hello is it possible with hibernate Criteria to return fields from more than one object....? something like this: .createQuery("select new map( b as bill, c as client, (SELECT sum((i.itemprice * rs.quantity) .......... ) FROM rstavka rs, item i WHERE .... URDER BY r.billno desc")... etc If yes, could someone show me some example??? I need to be able to users to ...

8. Criteria - Multiple object    forum.hibernate.org

If you are doing a query on bank accounts and how they relate to a bank, then you will want to have a many-to-one association in your mapping file. As an example, here is a snippet for one that I have done, where many reservations are associated with one guest: Code: ...

9. How to modify criteria object?    forum.hibernate.org

I don't think so. Download the source code and look at org.hibernate.impl.CriteriaImpl. You can cast your Criteria object to a CriteriaImpl and get further control over it, but I don't see methods for modifying it in the way you want. What's your reason for modifying it? Are you caching it and trying to reuse it? If so, you may want to ...





10. How to modify criteria object?    forum.hibernate.org

I don't think so. Download the source code and look at org.hibernate.impl.CriteriaImpl. You can cast your Criteria object to a CriteriaImpl and get further control over it, but I don't see methods for modifying it in the way you want. What's your reason for modifying it? Are you caching it and trying to reuse it? If so, you may want to ...

11. Criteria returning multiple copies of same object    forum.hibernate.org

Newbie Joined: Fri Jan 26, 2007 3:44 pm Posts: 4 Location: Kansas, US This appears to be related to EAGER fetching. I setup my DB to have 1 'Parent' record and 4 'Child' records, based on the following two classes... Code: package datamodel; import java.util.Set; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; /** * * @code_status Alpha * @author jayhawk ...

12. OR between two sub-Criteria objects    forum.hibernate.org

I have a query like "select this_.appNum as y0_ from CoreApplication this_ inner join LoanAndDeposit loananddep2_ on this_.appNum=loananddep2_.CoreApplication_appNum inner join OptionTrade optiontrad1_ on this_.appNum=optiontrad1_.CoreApplication_appNum where this_.applicationType in ( ?, ?, ?, ? ) and this_.status in ( ?, ?, ? ) and optiontrad1_.lastModifiedUser=? and loananddep2_.status=? ". For the last part i.e. OptionTrade.lastModifiedUser and LoanAndDeposit.status I have to do an OR instead ...

13. Criteria and using a proxy object    forum.hibernate.org

Hi, I'm using a ClientProxy object with a subset of the details from a full Client object. How can I create a query that queries using criteria from the full Client object but which returns only that information in ClientProxy? For example a Client has a marital status attribute, while a ClientProxy does not, but I want a list of ClientProxy's ...

15. Getting repeated objects when creating a criteria    forum.hibernate.org

Hello, When executing a criteria i'm getting repeated object. The criteria is: List results = session.createCriteria(MyClass.class) .add(Expression.eq("attr1", attr1)) .add(Expression.eq("attr2", attr2)) .list(); And the hbm.xml file for MyClass is: On the other hand, if i do the query like this : String sql_query = "select mc.attr1, mc.attr2 ...

16. Criteria instance object problem    forum.hibernate.org