criteria

What is Alef Hamza?

I found this one, in the Find box (as Search criteria) of the document viewer. What is supposed to match? ...

Table join using multiple columns in torque 3.3

Hi there, Here is something I'm trying to achieve using Apache Torque (3.3): Table 1: id f_id start_position end_position Table 2: id f_id start end I need to do: select * from table1 inner join table2 on table1.f_id = table2.f_id and ( (table1.start_position <= table2.start and table1.end_position >= table2.end...

How to write subquery in Criteria

Hi there, I have a SQL like this: Select tbl.id, tbl.name From (select table1.id, table1.name from table1 inner join table2 on table1.id = table2.id order by table2.priority ) tbl group by table1.id order by table1.name What I'm tring to archieve is to first sort (order by table2.priority), and then get the record with table1.i...

Criteria Querying question

how to select particular field using Criteria ? ...

NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

I have an odd problem in my current project. Lazy loading for queries does not work. When I query a list, nhibernate fetches all associations separately. I extracted small parts of it and put it into a separate solution. Basically what I've got now, is a Account-Table and a AccountSync-Table. Both have an ID and a URL, while the ID is j...

Adding a projection to an NHibernate criteria stops it from performing default entity selection

I'm writing an NHibernate criteria that selects data supporting paging. I'm using the COUNT(*) OVER() expression from SQL Server 2005(+) to get hold of the total number of available rows, as suggested by Ayende Rahien. I need that number to be able to calculate how many pages there are in total. The beauty of this solution is that I don'...

Hibernate detached queries as a part of the criteria query

Hi Hibernate, java experts can you please help me write detached queries as a part of the criteria query for the following SQL statement. select A.* FROM AETABLE A where not exists ( select entryid FROM AETABLE B where B.classpk = A.classpk and B.userid = A.userid and B.modifiedDate > A.modifiedDate ) and userid = 10...

How to use join in hibernate criteria following situation

Hello, We have two tables Family and Member, the relation between these two is Family has set of members in it but member don't have any family relationship within it. I wanted get member using dob and family for that I am using Hibernate criteria API's but I am not getting how to write join query since members don't have Family insta...

NHibernate many-to-one association refuses to load

I have the following mapping, the many-to-one property 'Message' has a corresponding one-to-many association in the 'RootMessage' class. <class name="IMessageReceipt" lazy="false" table="MessageReceipts" abstract="true"> <id name="Id"> <generator class="guid.comb"></generator> </id> <discriminator column="Discrimi...

Verifying contents of NHibernate Criteria

I'm looking to build complex queries using the NHibernate Criteria API. I'd like to verify that the criteria is constructed as I would expect without having to actually run the query. Is this possible? Are there any tips or techniques for doing it elegantly? ...

order by length of certain property in Hibernate Criteria

Hi, I want to write a hibernate criteria to do the same job as normal sql statement like this: select * from XXX where XXX order by length(name) desc. Whats the best way to do this and how can I do? Thanks in advance! ...

tricky hibernate criteria

Hi, I have a sql statement which I want to move it into hibernate criteria, but I am not clue how to do this. The problem is one of the WHERE clause which looks like the following ...(skip other parts)... ? ILIKE strprefix||'%' ...(continue) strprefix is the column name, the ? is the place i need to fill in the value. With criteria...

NHibernate include/exclude all

I'm building a complex security mechanism to filter access to objects depending on various rights. As part of this I want to have an initial OR in my query that excludes all possible results from the query before the permissions allow access to certain subsets. In SQL it would look like this: select * from Table where (1 = 0) ...

NHibernate Search with inheritance ...

Hello guys... I have a Client class like that: public class Client { public Person Pers { get; set; } } And I have 2 Person´s child class : public class PersonType1 : Person { protected string att1; protected string att2; } public class PersonType2 : Person { protected string att3; protected string att4; } pu...

Hibernate Criteria API equivalent for "elements()"

Is it possible to implement the following query using Criteria API? select order from ORDER as order,ITEM as item where item.itemID like 'ITM_01' and item in elements(order.items) ...

Nhibernate criteria query - ordering a collection

I have a Person class. A person class contains a collection of Friends (also Person objects). A person class also has a LatestLogin property which is the LatestLogin time. For a given person, I want to return their first 10 friends ordered by descending LatestLogin. HQL I can do no problem: select friends from Person person inner jo...

MS Access, Pass through query with complex criteria. Criteria include Select statments and vba functions.

I currently have multiple queries that query data from a few tables linked through ODBC, and some temporary tables that are edited through the user interface. I have complex criteria in my queries such as: SELECT * from ThingsData WHERE (Thing In(SELECT Thing from ListOfThings) AND getThingFlag() = True); In this case Thing is a field...

Nhiberate Criterion Expression Combining "ands" and "ors"

I am having a little trouble with building my criteria object. Normally, I Build my cruteria similarly to this: ISession session = GetSession(); ICriteria criteria = session.CreateCriteria(typeof(MyObject)) .Add(Expression.Gt("StartDate", DateTime.Now.ToUniversalTime())) .Add(Expression.Eq("SubObject.Sub...

NHibernate Lambda Extensions - Eager Loading a collection's assosciations

I've got a Criteria Query for a social networking site. A Person object has a collection of Friends (also person objects). The query grabs the first N friends, but I also want to eager load an associated object MainProfileImage and then a subsequent associated object MediumThumbnail. I can do this in HQL easily: select friends from P...

Using CreateCriteria and selecting row based on maxvalue

Hi, I want to select a row from one table in the database using CreateCriteria where I have a know value for a column, not primary key so there will be multiple rows matching. The table contains update information so we have a column that contains a version number for each row based on which along with my primary question gives a singl...