criteria Questions

3

Solved

I want to take Nested object values in Hibernate Projection List. I having Pojo 'Charge' and 'Tariff' class with OneToMany and ManyToOne relations. My sample code is as following: Charge private...
Coze asked 10/3, 2015 at 17:25

2

Solved

I'm using JPA 2.0. Hibernate 4.1.0.Final, and Java 6. How do I write a JPA query from the following psuedo-SQL? select max(e.dateProcessed) from Event e where e.org = myOrg And my domain object ...
Spray asked 2/5, 2013 at 21:53

4

Solved

I'm trying, as in title, to insert a subquery in select clause like in this simple SQL: SELECT id, name, (select count(*) from item) from item this is obviously only a mock query just to make my...
Powys asked 11/1, 2011 at 20:33

7

Does anyone have a good example for how to do a findByExample in JPA that will work within a generic DAO via reflection for any entity type? I know I can do it via my provider (Hibernate), but I do...
Abbey asked 21/5, 2010 at 7:17

2

When using the JPA Criteria API, what is the advantage of using a ParameterExpression over a variable directly? E.g. when I wish to search for a customer by name in a String variable, I could write...
Exhilarative asked 8/5, 2013 at 10:31

3

Solved

I need a generic Criterion which forces the result to zero matches. Something like Restrictions.eq(true, false) ?
Erg asked 19/4, 2010 at 11:58

8

Solved

I have a Person class which has a String collection of aliases representing additional names that person may go by. For example, Clark Kent may have aliases "Superman" and "Man of Steel". Dwight Ho...
Sartre asked 26/2, 2010 at 22:59

3

I have a sql table A with column names name, id1, id2, val1 and a table B with column names id1, id2, key1, key2 and this is my sql query SELECT v1.id1, v1.id2 FROM ( SELECT A.id1, A.id...
Galinagalindo asked 2/12, 2016 at 14:45

3

Solved

Consider the following two tables: Project ( id, project_name) Status ( id, id_project, status_name) Where Status contains all statuses in which a Project has been. Lets say we want to query ...
Pocosin asked 20/12, 2016 at 11:9

3

Solved

I need to receive location changes both from Network and GPS providers. If GPS provider not avaliable or has not location (bad sattelite visibility) I would receive location from Network provider...
Preadamite asked 28/3, 2013 at 10:17

2

Solved

My problem is null values must be last order by statement. My code snipshot below. I use javax persistance criteria builder. My query complicated. import javax.persistence.criteria.CriteriaBuilder...
Manolete asked 29/6, 2015 at 10:13

1

Solved

Given a Predicate used in a CriteriaQuery, e.g. this: Predicate predicate = root.get(MyTable.col1).in("col1Val1", "col1Val2"); Can this be extended to use multiple ANDed fields, e.g. the same as...
Dudden asked 7/11, 2016 at 18:16

5

Solved

I want to implement some universal filter with Hibernate Criteria. It should work like LIKE operator from SQL: SELECT * FROM table WHERE table.ANYCOLOUMNHERE LIKE '%'||anyvaluehere||'%' I have M...
Pack asked 4/7, 2012 at 11:41

5

Solved

I'm not sure how to describe this problem, so I think an example is the best way to ask my question: I have two tables with a manyToMany relationship: DriversLicence <-> LicenceClass LicenceC...
Mosasaur asked 5/11, 2008 at 4:25

2

Solved

This question is titled similar to this one, but it's no duplicate as the other OP actually wanted something else (anyway, there's no answer to my question there). What I want is to recycle my alre...
Quittor asked 14/9, 2016 at 17:3

1

Solved

I have a situation where in my where clause I have single predicate and expression. And both needs to be ANDed in where clause: Expression<String> col1 = tableEntity.get("col1"); Expression&...
Deach asked 9/10, 2014 at 16:14

2

Solved

I have this situation: public class AnswerSet { public virtual IList<Answer> Answers {set; get;} } session.CreateCriteria<AnswerSet>() .CreateAlias( "Answers", "a" ) .SetProjection(...
Thagard asked 8/4, 2011 at 6:40

1

Solved

I need to replicate this query into JPA CriteriaBuilder code: .... where article.client_id = 1 and article.price > 0 and ( article.code like '%this is statement%' or article.oem_code lik...
Curlew asked 15/7, 2016 at 15:47

7

Solved

I have to following entity object @Entity public class Foobar { ... private List<String> uuids; ... } Now I'd like to make a criteria query which would fetch all Foobar pojos whose u...
Silverman asked 29/4, 2010 at 6:0

2

Solved

I'm trying to get a report using Criteria and ProjectionList, and I'm pretty new using this through hibernate. So I have this model: private Long _userId; private Category _category; private ...
Yonder asked 14/1, 2010 at 20:34

1

Solved

I have entity @Entity @Table(name = "CRM_LOG") public class CrmLog implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private @Getter @Setter Long id; ............
Pennant asked 6/5, 2016 at 4:33

2

Solved

I am trying to use subqueries in an application I am writing using JPA 2.0 type-safe criteria API, with Hibernate 3.6.1.Final as my provider. I have no problem selecting primitive types (Long, MyEn...
Siusiubhan asked 15/3, 2011 at 20:27

2

I'm using Hibernate and Postgres and defined a character(1)[] column type. So I don´t know how to make this criteria to find a value in the array. Like this query SELECT * FROM cpfbloqueado WHE...
Niedersachsen asked 7/4, 2016 at 0:36

1

Solved

I have new problem. I created some code, which generate Predicate, from client request. This is initializing part: criteriaBuilder = entityManager.getCriteriaBuilder(); criteriaQuery = criteriaB...
Rainarainah asked 26/3, 2016 at 13:4

3

Solved

I ned to get only a few column values from the table. So I have used Projections to achieve this. The code works, but I don't think it is effective. My issue was when I used ProjectionsList &...
Lubricious asked 15/6, 2012 at 19:42

© 2022 - 2024 — McMap. All rights reserved.