Questions tagged [detachedcriteria]

189 questions
0
votes
2 answers

Hibernate queries where with many-to-many fields

I have a model A that has a many to many with B, which has a property c. Like the following. class A { @ManyToMany List bs; } class B { @ManyToMany List as; String c; } Is there a way (using detached criteria) to do a query like…
Razvi
  • 2,808
  • 5
  • 31
  • 39
0
votes
2 answers

Hibernate Criteria API filter a collection proporty

I have Class A{ List bList } Class B { String name; } Now I want to write query using Hibrnate criteria API , so that I only get A pojo's with a filtered bList property having only B pojo's where "b.name" == 'abc'
user620339
  • 851
  • 3
  • 20
  • 42
0
votes
1 answer

Hibernate using DetachedCriteria with interfaces

Using Hibernate 3.6.8.Final and Spring 3.0.5.RELEASE , I'm trying to add some Common DAO functionality for classes that have multiple implementations overridden higher up to implement the specific classes however it doesn't work for…
Wysawyg
  • 712
  • 8
  • 22
0
votes
0 answers

Castle ActiveRecord .net C# how to implement IndexOf

I would like to implement IndexOf for ActiveRecord mapped class by using ordering and custom filtering criteria something like this: long MyEtityType.IndexOf( MyEntityType myEntityInstance, DetachedCriteria filter, String…
user861768
  • 175
  • 1
  • 12
0
votes
1 answer

one-to-many detached Criteria parent table fetch based on child table

i have one problem in one-to-many mapping using hibernate. i have 2 classes, Person and Address. Person is mapped by Address ( one-to-many) i want get all Person where Address = "xxxx";. how to prepare this query using DetachedCriteria . below i…
0
votes
0 answers

Grails How to set resultTransformer on DetachedCriteria?

In Grails 3.1 I have this code: def criteria = new DetachedCriteria(SampleObject).build {} criteria.projections { property('id') } criteria.list() That returns a list of ids (Long). But I want a list of SampleObject with the id. The problem is…
Victor Soares
  • 757
  • 1
  • 8
  • 34
0
votes
0 answers

Hibernate DetachedCriteria queries of sub entities

I have a class User. User class have name field and Address fields. Address is another class. Adress class have 3 fields, name, zipcode and City. City is another class. I want to query User but I do not want to generate any query on City class.…
0
votes
0 answers

How to write this mysql in DetachedCriteria in Hibernate

How to write this mysql in DetachedCriteria in Hibernate SELECT * FROM DEPRECIATION DEP INNER JOIN DEPRECIATION_SCHEDULE DS ON DS.DEPRECIATION_ID = DEP.DEPRECIATION_ID GROUP BY DS.DATE
Michael Vern
  • 201
  • 1
  • 1
  • 3
0
votes
1 answer

DetachedCriteria list methor with order param in nested property

I want to use the DetachedCriteria's list method with a domain with nested properties and order by one of the attributes in one of those properties. I'm trying creating an alias criteria.createAlias("user", "user") and then listing: def userRoleList…
0
votes
2 answers

Error when using DetachedCriteria for both Count and Findall in Castle Activerecord

Guys, I've got this problem that I searched almost everywhere (maybe I don't know the right keyword for it.) I need your help! The relationship is quite simple, I have two Activerecord Domain: Team and User, and they have HasAndBelongsToMany…
larryzhao
  • 3,173
  • 2
  • 40
  • 62
0
votes
1 answer

Hibernate Detached Criteria

I have a DetachedCriteria which I am using to search a table based on a name field. I want to make the search case-insensitive, and am wondering if there is a way to do this without using HQL. Something like: private void…
Elie
  • 13,693
  • 23
  • 74
  • 128
0
votes
1 answer

Hibernate Criteria to take the first record

I am trying to resolve a bug in my system, related to pagination. When a user selects a record, we retrieve all the associated records back to the user using pagination. With the page maxResults set, the DB retrieves the max records but they are…
0
votes
1 answer

Translating to detachedCriteria

How can I translate the following query to detachedCriteria: select * from ( select a.* ,row_number() over (partition by hotel_id order by EXECUTION_START_DATE desc) rnk from HOLIDAY_PACKAGES a ) where rnk = 1
Anat
  • 143
  • 2
  • 8
0
votes
1 answer

Filtering objects using ActiveRecord,NHibernate, DetachedCriteria

C# 3.0, Nhibernate 2.1.2 , Castle ActiveRecord 2.1, WinXP 32 I have a problem filtering elements with ActiveRecord and DetachedCriteria. There are 2 tables one contains the objects to be filtered (PropertyContainer) and the other contains the values…
Alex
  • 3
  • 2
0
votes
1 answer

GORM fetch and update in batches

I need to update a single property on a large set of data in Oracle database with grails 2.5 Right now my code looks similarly to this: List booksToUpdate = [] boolean moreBooks = true int offset = 0 while (moreBooks) { def…