criteria Questions

2

Solved

I have the following statement to concatenate two columns which works well Expression<String> stringConcat = cb.concat(cb.concat(root.get(Employee_.userId), " # "), joinDept.get(Employe...
Spacetime asked 25/11, 2015 at 12:3

3

Solved

I have a table Player with columns id, name, wins, games_played. I mapped it to a class Player. I want to do the following query in Hibernate (preferably with Criteria, if not possible with Criteri...
Allaallah asked 3/3, 2010 at 10:3

5

I have a Criteria-Query, which joins a second table B, to select entities from table A. The problem is, that this query returns some entities from table A multiple times. But I need the results to ...
Missal asked 9/1, 2010 at 23:20

2

I am a bit confused about these three concepts. Criteria API Query Dsl Jpa 2.0 meta model From what I have read, One of the major benifits of using QueryDsl or JPA metamodel is type safety. But...
Disputatious asked 15/11, 2018 at 18:8

4

Solved

In oracle I have dates in format 17-April-2011 19:20:23.707000000 I would like to retrieve all orders for 17-04-2011. SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-YYYY"); String my...
Unclose asked 26/4, 2011 at 12:50

7

I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if it's possible using criteria ? An example : final Strin...
Chartism asked 12/9, 2008 at 9:33

3

Solved

I am trying to query PostgreSQL database using Hibernate's restriction criterion like() with a partial keyword: Criterion c1 = Restrictions.like("stateName", "Virg*"); cri.add(c1); return cri.lis...
Leckie asked 10/1, 2013 at 18:12

3

Solved

I have list of category. I need a list of category by excluding 2,3 row. Can we achieve through hibernate by using Criteria and Restriction?
Heavierthanair asked 3/8, 2009 at 6:35

2

Solved

How would I achieve this using Hibernate Restrictions? (((A='X') and (B in('X',Y))) or ((A='Y') and (B='Z')))
Junkman asked 14/11, 2011 at 18:53

1

Solved

I'm writing a method to implement a query using MongoRepository, I'm using aggregation in a Java/Spring project, but it is giving exceeded memory limit when I'm testing. I've tried use newAggreg...
Keli asked 6/6, 2019 at 12:19

5

Solved

In this query: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Tuple> q = cb.createTupleQuery(); // FROM GamePlayedEvent gpe Root<GamePlayedEvent> gpe = q.from(GamePlayedE...
Astern asked 29/12, 2010 at 13:54

5

Solved

For this question, we want to avoid having to write a special query since the query would have to be different across multiple databases. Using only hibernate criteria, we want to be able to escape...
Churchill asked 23/3, 2009 at 14:8

2

Solved

I have a collection that has two date fields and I am trying to query all records that have a difference of 15 days: { "_id" : "someid", "factoryNumber" : 123, "factoryName" : "some factory nam...
Gmur asked 20/12, 2018 at 15:7

8

Solved

I have a datatable, dtFoo, and would like to get a count of the rows that meet a certain criteria. EDIT: This data is not stored in a database, so using SQL is not an option. In the past, I've us...
Photometer asked 9/3, 2011 at 22:18

3

Solved

I have a submission table with columns like ID, Name, Code among other properties. My requirement is to search for records based on the mentioned properties and return a paginated set. This is the...
Reine asked 18/4, 2013 at 16:56

2

Solved

I am trying to get selected columns from a table using hibernate criteria query Criteria cr = session.createCriteria(OfferCashbackMaster.class) .setProjection(Projections.projectionList() .add(P...
Norikonorina asked 25/2, 2018 at 10:29

5

Hibernate Criteria support provides a setMaxResults() method to limit the results returned from the db. I can't find any answer to this in their documentation - how is this implemented? Is it quer...
Pottage asked 31/8, 2011 at 22:38

3

When trying to search for multiple values of a relation, duplicate results are returned. How can I avoid these duplicates? We have a method on our service that builds the Criteria: @Override pro...
Gawain asked 25/2, 2014 at 11:29

8

Solved

Using Hibernate's Criteria API, I want to select the record within a table with the maximum value for a given column. I tried to use Projections, creating an alias for max(colunName), then using i...
Forsythia asked 10/10, 2010 at 11:25

1

I have a table named messages containing toUser, message and status columns. I want to update all the statuses of the messages with a specific user. So, I wrote a query like this, Session s = DB....
Account asked 29/1, 2018 at 10:27

1

Solved

I need a function that will be filter parameters and build query. I have 4 parameters therefore if I would try to implement query for each condition I would have to write 16 (2^4) implementations -...
Salesroom asked 11/1, 2018 at 15:8

2

Struggling to write the following query using JPA. Oracle Query: Select * from table1 s where exists (Select 1 from table2 p INNER JOIN table3 a ON a.table2_id = p.id WHERE a.id = s.table3_id ...
Sartorial asked 7/10, 2013 at 10:49

2

Solved

I have two tables: ReportRows and DataRows Table ReportRows: @Id @Column(name = "ID") private Long id; @ManyToOne @JoinColumn(name = "T_REPORT_CODE") private Report report; @OneToOne(fetch = F...
Precursory asked 30/4, 2016 at 12:27

4

Solved

This is the code : Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(Contact.class) .add(Restrictions.like("gender", "male", MatchMode.ANYWHERE)));...
Loferski asked 1/9, 2016 at 9:11

2

Solved

I want to write the below InsertInto query in Hibernate Criteria. Any Suggestions .. thanks for help sql = "insert into selectedresumes values('" + companyId + "','" + resumeId + "','" + resu...
Weighting asked 5/6, 2011 at 6:42

© 2022 - 2024 — McMap. All rights reserved.