Questions tagged [detachedcriteria]

189 questions
0
votes
1 answer

DetachCriteria paginated query returns duplicate values

I've got a paginated detached criteria execution which return rows of an entity. The entity class is as following. @Entity @Table(name="POS_T_HTL_ITEM_GROUP") public class HotelItemGroup extends Versioned { private static final long…
Imesh Chandrasiri
  • 5,558
  • 15
  • 60
  • 103
0
votes
1 answer

Hibernate DetachedCriteria Query with and clause in subselect

How can I solve this query with Hibernate's detached criteria? The hardest part for me is to bring the and u1.abrechnungsDatum is null into the subselect. I want a query like this: select * from patient as p where p.krankenstand = ? and …
Tarator
  • 1,517
  • 1
  • 13
  • 30
0
votes
2 answers

How can I create this query in Hibernate?

I have an SQL query and I'd like to translate it into Hibernate, the group by property is making me crazy: select idestadoseccion,estado_1,estado_2,estado_3,estado_4,estado_5,fechaalta,idpaciente from estado_secciones where fechaalta between ? and…
pepin
  • 1
0
votes
1 answer

Grails Detached Criteria with Composite key

Domain Setup . Study { Long id String name Site site USState state ... } . Site { Long id String name ... } . Resource { Long id String name Boolean active USState state ... } . SiteResource { …
Vaesive
  • 105
  • 1
  • 11
0
votes
0 answers

Hibernate aliasToBean is not working

I have a class called "AppModel" and a query in DetachedCriteria. My colleague and I didn't find the reason of why it is not working. Did I miss some important code or make a mistake? Here's my class: public class AppModel { private Long id; …
Nick Eng
  • 61
  • 1
  • 1
  • 3
0
votes
1 answer

grails dynamically add gorm subquery to existing query

I would like to have a util for building queries, so that I can add specificity to a common query rather than hard coding similar queries over and over again. For instance: DetachedCriteria query = DeviceConfiguration.where { ...…
SnoopDougg
  • 1,467
  • 2
  • 19
  • 35
0
votes
1 answer

In NHibernate, how do I combine two DetachedCriteria instances

My scenario is this: I have a base NHibernate query to run of the form (I've coded it using DetachedCriteria , but describe it here using SQL syntax): SELECT * FROM Items I INNER JOIN SubItems S on S.FK = I.Key The user interface to show the…
Trevor
  • 559
  • 5
  • 12
0
votes
1 answer

Hibernate Criteria and metamodel

I could not find anywhere if it possible to create metamodel over entites to be used in Hibernate's Criteria API. So I don't have to write strings for fields, but rather rely on the generated metamodel similarly as it can be done with JPA Criteria…
redhead
  • 1,264
  • 1
  • 17
  • 32
0
votes
1 answer

Problem using Hibernate Projections

I'm using Richfaces + HibernateQuery to create a data list. I'm trying to use Hibernate Projections to group my query result. Here is the code: final DetachedCriteria criteria = DetachedCriteria .forClass(Class.class, "c") …
Lucas
  • 1
  • 2
0
votes
1 answer

Simple Criteria query - Select From IN

I have table Events | EVENT_ID | OTHER | ---------------------------- | | | | | | | | | and table EventCategories that contains foreign key for Event table: | …
0
votes
1 answer

Grails Where Queries: expand DetachedCriteria in method does not work

I've made a new Grails project with only: TestDomain.class: class TestDomain { String var1 String var2 } Bootstrap.groovy: def init = { servletContext -> if (TestDomain.count() == 0) { new TestDomain(var1: "a", var2:…
0
votes
1 answer

NHibernate Lambda Extensions can't use any alias query on DetachedCriteria

I'm trying to write a simple query that requires an alias as it's a Many-To-Many assocation however I can't get it to work with NH Lambda Extensions. It always gives me a compile error even though as far as I can tell it's exactly the same as the…
Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
0
votes
2 answers

Hibernate 4.3.5 DetachedCriteria not fetching lazy list

I have a simple query that worked for a good time, now i changed some stuff in my code to: (hibernate.cfg.xml) org.hibernate.transaction.JDBCTransactionFactory
Simego
  • 431
  • 5
  • 16
0
votes
1 answer

Adding a DetachedCriteria-subcriteria to a projectionList

i want to construct a a pojo with some records from 2 tables using Hibernate criteria api. I'm constructing a ProjectionList with needed records from the 1st table, because i don't have a bidirectional relationship between the 2 tabls , have only…
Eli
  • 59
  • 5
0
votes
1 answer

Hibernate Criteria and DetachedCriteria concate Properties or fields

i have a criteria like public ArrayListgetStudentsWithPicture(final Student student) { final Criteria criteria = session.createCriteria(Student.class).add(and(prepareForSelect())); criteria.add(Subqueries.gt(1L,getDetached);//the…
chiperortiz
  • 4,751
  • 9
  • 45
  • 79