criteria Questions
1
I have database in mysql. On the php application I want to create a textarea and allow users to write a "query" to filter the data on the table.
I want to create a query parser for users to filter...
6
Solved
To make it short: hibernate doesn't support projections and query by example? I found this post:
The code is this:
User usr = new User();
usr.setCity = 'TEST';
getCurrentSession().createCriteria(...
Avion asked 17/9, 2008 at 15:40
2
I have a table, "Quote", mapped in hibernate that has a composite key of an integer id and a date, and several additional columns. I'd like to write a criteria query that uses a DetachedCriteria to...
Acceptation asked 1/10, 2013 at 19:28
3
Solved
Normally when ordering ascending by a field, you get the NULL values first, and then the more interesting values. Often, you want NULL values last. In MySQL, you can do this with:
SELECT * FROM pe...
1
I want to delete (JPA 2.1) all patients from one Hospital, but run into a problem:
UPDATE/DELETE criteria queries cannot define joins
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
Criter...
2
Solved
I want to execute a query matching a specific subclass property, so I'm trying to use treat().
In this example I want:
all subjects with name starting with 'a',
or all subjects, which are person...
Skep asked 13/12, 2015 at 14:2
1
Solved
The following criteria query calculates the average of rating of different groups of products.
CriteriaBuilder criteriaBuilder=entityManager.getCriteriaBuilder();
CriteriaQuery<Tuple>criteri...
Fulk asked 20/11, 2013 at 6:13
2
What's wrong with
session.createCriteria(Composed.class, "main")
.createAlias("main.id.branch", "b1")
.add(Restrictions.eq("b1.owner", user))
.list();
? The corresponding HQL works fine
String ...
2
Solved
I have following dao method:
@Override
public List<AdminRole> findAll() {
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(AdminRole.class);...
Shawn asked 14/10, 2015 at 14:7
3
Solved
As my question states, I would like to know what we call types of queries with that type of condition in the WHERE clause, i.e.:
SELECT * FROM mytable
WHERE (col1, col2) < (1, 2);
In other wo...
Fresno asked 7/10, 2015 at 0:34
4
I want to ask, it is possible that I create query projections and criterion for more than one level deep?
I have 2 model classes:
@Entity
@Table(name = "person")
public class Person implements S...
1
Solved
A database function returns id's of all events within a certain radius, ordered by their distance.
Afterwards, to preserve performance I'm eagerly loading necessary collections in withCriteria lik...
Organic asked 28/8, 2015 at 19:10
1
I want to write the following query as a Hibernate Criteria query:
select
to_char(nvl(ol.updated_datetime, ol.created_datetime), 'dd/mm/yyyy'), sum(discount_price)
from order_line ol
where nv...
1
Solved
I have following entity classes:
@MappedSuperclass
public class AbstractEntity implements Serializable, Comparable<AbstractEntity> {
private static final long serialVersionUID = 1L;
@Id
...
1
Without using CriteriaQuery#select() :
public List<Address> getAddressOfManager(String designation, String name, String orderByColumn) {
Boolean ascending = false;
CriteriaBuilder cb = e...
Truehearted asked 17/5, 2015 at 18:53
3
I'm trying to use GROUP BY in my criteria. I need to do this:
SELECT b FROM Book b GROUP BY volumeCode;
I have following code:
Criteria c = s.createCriteria(Book.class);
c.setProjection(Proje...
2
Solved
I need to adapt the following code example.
I've got a MySQL query, which looks like this (2015-05-04 and 2015-05-06 are dynamic and symbolize a time range)
SELECT * FROM cars c WHERE c.id NOT IN...
2
I need to use criteria to query a database.
The data I'm searching has a date, say 'startDate' and I have a month say 0 for January, I need to extract all data where startDate has month = 0; in sql...
1
Solved
Let's say I have the following example entities - one is an @Embeddable, embedded inside another @Entity:
@Embeddable
public class ContactInfoEntity {
@Column
private String phone;
@Column
p...
Grossularite asked 13/3, 2015 at 1:10
4
Solved
Lets say I have a table that holds information about festivals.
Each festival has a start and end date.
I want to select all the festivals that are live (that happen) on a given date.
Meaning, I wa...
Homage asked 18/3, 2011 at 8:52
3
Solved
I want to perform a LEFT OUTER JOIN between two tables using the Criteria API. All I could find in the Hibernate documentation is this method:
Criteria criteria = this.crudService
.initializeCrit...
Hettiehetty asked 5/2, 2010 at 11:20
2
I'm looking to create a Left outer join Nhibernate query with multiple on statements akin to this:
SELECT
*
FROM [Database].[dbo].[Posts] p
LEFT JOIN
[Database].[dbo].[PostInteractions] i
ON ...
Clupeoid asked 3/5, 2010 at 4:43
1
Solved
I have a little trouble. I am using JPA Criteria to make a dynamic select (using criteria as the the where clause has optional variable...) but one of my entity has a EmbeddedId that contains the u...
Carmon asked 21/11, 2014 at 12:46
1
Solved
I am a bit confused about aliases to be honest so I am hoping someone can help me understand them better. In order to explain what I am missing I will use examples.
Lets say that I have:
Criteria...
0
I am trying to use aliases along with the normal association names in a criteria which is giving me "duplicate association path error" my classes are as follows
class FlightReservation{
Flight fl...
Latona asked 29/10, 2014 at 16:44
© 2022 - 2024 — McMap. All rights reserved.