Questions tagged [detachedcriteria]
189 questions
0
votes
1 answer
HibernateCursorItemReader with Hibernate Detached criteria
How to use hibernate detached criteria with "HibernateCursorItemReader" of spring batch?

Soutrick
- 77
- 1
- 9
0
votes
2 answers
Can you create a Restriction for a Detached Criteria on a primitive collection?
I would like to know if there is a way to create a Restriction on a primitive collection of a Model in NHibernate.3.3.3?
Here's the details:
class Parent {
IEnumerable ChildNames { get; set; }
}
I need to search like so:
private…

bighead.dev
- 176
- 1
- 8
0
votes
0 answers
Grails DetachedCriteria Eq ignore case
Using Grails 2.3.0: According to the documentation: http://grails.org/doc/latest/ref/Domain%20Classes/createCriteria.html
One can create case-insensitive Eq criterions, using a third argument [ignoreCase: true]. Like this:
eq(field, string,…

Hoof
- 1,738
- 2
- 17
- 39
0
votes
0 answers
Hibernate DetachedCriteria for this JOIN with 'OR' filters across two tables
For SQL
SELECT PP.m, PP.f, PP.l, PP.c, RP.n as 'RPn' FROM P as PP
INNER JOIN RPP AS RP ON PP.id = RP.id
WHERE PP.m LIKE '%0%' OR PP.f LIKE '%0%' OR PP.l LIKE '%0%' OR RPP.n LIKE '%0%'
I have tried to create this DetatchedCriteria:
…

foamroll
- 752
- 7
- 23
0
votes
3 answers
Using a subselect in a join using NHibernate
I would like to write the following SQl in NHibernate - Detached Criteria if possible.
select * from parent
INNER JOIN child on parent.id=child.parentid
INNER JOIN
(select ChildID, MAX(ChildDate) MaxChildDate from child group by ChildID) max
ON…

Stu
- 2,426
- 2
- 26
- 42
0
votes
1 answer
Nhibernate DetachedCriteria: Find entities where a property's property match a value
I have two following classes:
public class User
{
public virtual Guid Id { get; set; }
public virtual UserCredentials Credentials { get; set; }
// other stuff
protected User() { }
}
public class UserCredentials
{
public…

Morten Jacobsen
- 986
- 1
- 11
- 31
0
votes
1 answer
Refactor giant single query to a lot of smaller subqueries, but with the same result
I have the list of parameters, and I want to build the query from it.
Actually, I've already finished that work, and now I have the giant method, which I've trying to refactor.
I need the way to split the one giant method to a lot of smaller methods…

wwarlock
- 443
- 4
- 14
0
votes
1 answer
Join Different tables using Criteria
I have two different entities, I need to join them based on a common entity property between them, but there's no path to get from the entity the Criteria is created on to the other one!
Please help.
Thanks
--Edit--
Sorry, maybe my question was not…

Ruba
- 867
- 3
- 11
- 19
0
votes
1 answer
DetatchedCriteria without on clause
I'm relatively new to Hibernate. I have to use the 3.2 version and i need to use DetachedCriteria and obtain the following query:
select this_.ID as ID0_1_, this_.SNDG as SNDG0_1_
, this_.NDG as NDG0_1_, this_.T_GWR_PARTNER_ID as T4_0_1_
,…
0
votes
0 answers
Unknown column in 'where clause' while using detachedcriteria with collections property
I have 3 tables : BookInfo, AuthorInfo and BookAuthors
BookInfo has one to many relationship with BookAuthors.
Mapping in BookInfo.hbm.xml :

Ashish Tanna
- 645
- 1
- 10
- 25
0
votes
1 answer
How to sort the List of names by using DitachedCriteria in hibernate?
Here, i am posting what i need from you!
DetachedCriteria criteria = DetachedCriteria.forEntityName(DomainEntity.tbl_user.toString);
criteria.addOrder(Order.asc("username"));
List user = dao.getEntities(criteria);
This code is working fine,…

Nallamachu
- 1,420
- 18
- 34
0
votes
0 answers
HibernateCallback returns value even though search criteria is not qualified
I am having a trouble with my codes. If I input correct criteria, let say 300 for the amount it returns correct result/s.But if I put not qualified search criteria it still return result/s which is incorrect.
@Override
public Page…

kwan_ah
- 1,061
- 1
- 12
- 18
0
votes
1 answer
How to translate a QueryOver to DetachedCriteria?
I do not wish to know why it's better to use QueryOver and that it's newer.
How can I translate the following QueyOver to a DetachedCriteria:
QueryOver().Where(x => x.Properties.Any(y => y.Locales.Any(l => l.Value.Name == "propName")));
I…

Adam Tal
- 5,911
- 4
- 29
- 49
0
votes
1 answer
How to use NHibernate DtachedCriteria sub queries to filter by list of referenced entities properties?
I want the outcome to be a single sql statement.
I have the following structure:
public class B
{
public virtual int Id { get; set; }
public virtual int BNumber { get; set; }
}
public class A
{
public virtual int Id { get; set; }
…

Adam Tal
- 5,911
- 4
- 29
- 49
0
votes
2 answers
How to write this SQL in HQL or using Criteria?
Is there any way to rewrite equivalent of below SQL in Hbernate HQL or Using Hibernate Criteria (or DetachedCriteria)? It should return single record from database.
And Which one is advisable using HQL or Criteria or just native SQL?
Select * from X…

Sam
- 1
- 3