criteria « Field « JPA Q&A





1. how to query specific fields in hibernate criteria    stackoverflow.com

I need to fetch only specific feilds instead of all fields. All my tables has audit feilds(4) . i want that to be ommitted on the selection. how to do that ...

2. Refering to an earlier aliased field in a criteria query    stackoverflow.com

In this query:

CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Tuple> q = cb.createTupleQuery();

// FROM GamePlayedEvent gpe
Root<GamePlayedEvent> gpe = q.from(GamePlayedEvent.class);
// SELECT gameId, COUNT(*) AS count, AVG(duration)
// AS avDur, AVG(rewardCurrency) AS avCur, AVG(rewardXP) avXp
q.select(cb.tuple(
    ...

5. Querying fields from superclass entity on Hibernate Criteria    forum.hibernate.org

Newbie Joined: Tue Apr 13, 2010 6:14 pm Posts: 6 Location: El Salvador Hi to all, i have a little issue with Hibernate Criteria. I have 2 entities, one is the super entity of another, as you can see: Code: public class ComTiendas implements java.io.Serializable { private long idtda; private ...

6. Criteria Restrictions - could not get a field value by    forum.hibernate.org

Hi, I have following DetachedQuery: Code: DetachedCriteria criteria = DetachedCriteria.forClass(Project.class, "project"); criteria.createAlias("status","projectStatus", CriteriaSpecification.LEFT_JOIN); criteria.createAlias("priority","projectPriority", CriteriaSpecification.LEFT_JOIN); criteria.createAlias("type","projectType", CriteriaSpecification.LEFT_JOIN); criteria.createAlias("account","projectAccount", CriteriaSpecification.LEFT_JOIN); criteria.createAlias("owner","projectOwner", CriteriaSpecification.LEFT_JOIN); criteria.setProjection( ...

7. Criteria CONCAT fields...    forum.hibernate.org

How i can concanete some fields with criteria API ? sql example: select * from person where concat(person.firstName,' ',person.middleName,' ',person.lastName) like '%aPerson%' i try something like this... but doesn't work... Criteria criteria = session.createCriteria(Person.class); criteria.add(Expression.ilike("firstName middleName lastName ", keyWord)); criteria.list(); org.hibernate.QueryException: could not resolve property: firstName middleName lastName of: br.usp.lsi.contact.Person tnx... Markus Reichel

8. calculated field in criteria?    forum.hibernate.org

Hi there I would like to find a calculated field inside my DetachedCriteria query and return it as part of the result. For example: I have an end date and a start date and I want to calculate the duration between the two (the exact field is not in the database object) I have not been able to do this - ...

9. Criteria not working with many-to-many field    forum.hibernate.org

@Entity public class Asset extends Basic { // Fields @Id private Long id; @ManyToOne private Users validatedByUser; @ManyToMany(targetEntity = Business.class) @JoinTable(name = "ASSET_BUSINESSES", joinColumns = { @JoinColumn(name = "ASSETID") }, inverseJoinColumns = { @JoinColumn(name = "BUSINESSID") }) ...





10. Sybase Bit Field, Criteria    forum.hibernate.org