I want to execute the following SQL
select count(*) as myCount from user group by name;
I came up with the following criteria for the same
DetachedCriteria.ForClass(typeof(UserDTO))
.setProjections(Projections.ProjectionList()
.Add(Projections.rowCount(),"myCount")
.Add(Projections....
I have criteria:
ICriteria criteria = Session.CreateCriteria<Entity>()
.SetFetchMode("Entity1", FetchMode.Eager)
.SetFetchMode("Entity2", FetchMode.Select)
.SetMaxResults(max)
.SetFirstResult(min)
.Add(Restrictions.Eq("Available", true))
.Cre...
I have a type Type1 with a property Type2s consisting of a List<Type2>. I have configured the NHibernate mapping for the property as follows:
[Map(0, Table = "Type2s", Schema = "MySchema", Cascade = CascadeStyle.All, Lazy = true, Inverse = true)]
[Key(1, Column = "Type1Id")]
[OneToMany(2, Class = "Type2, MyNamespace")]
What is the dif...
Hello,
I am unable to find something like this in documentation provided for Propel Criteria in Symfony 1.4
The criteria, by default, is:
$this->Merchantss = MerchantsPeer::doSelect(new Criteria());
However, this selects all the fields in the table for 'Merchants'. I would only like to select a couple, lets say: id, name, category. ...
Hi Everyone,
I was wondering if anyone could help me understand why these two criteria do not return the same result sets. To me, it seems weird that SQL Server 2008 R2 wouldn't know to use the offset while constraining the data. Is there a better way to do this? As far as I can tell, Criteria Two is the only way to get the correct data...
Is it possible to create a anoynmous count with nhibernate?
The below query throws the exception "No column *".
I could of course add a column name, but I'd prefer not to, because if I do, I'll have to lookup column names for 95 tables...
NHibernate.Criterion.DetachedCriteria dcIsUniqueDomainname = NHibernate.Criterion.DetachedCriteria...
I have a query and I would like to use an IIf function as part of the criteria. Here is the full SQL:
SELECT Hits.HitID, Hits.ListingID, Hits.HitCount, Hits.HitDate, Hits.HitTypeID, Hits.IsDeleted
FROM Hits
WHERE (((Hits.HitDate)>=[Forms]![frmReports]![txtStartDate]) AND ((Hits.IsDeleted)="N"));
Here is the piece of code that causing...
I have criteria query that, when executed, results the following exception thrown:
java.lang.IllegalArgumentException: org.hibernate.QueryException: illegal syntax near collection: id [select generatedAlias0.permissions from temp.package.commons.user.Role as generatedAlias0 where generatedAlias0.id=2L]
at org.hibernate.ejb.AbstractEntit...
Hi!
I'm having a hard time constructing a criteria query to get the "permissions" attribute from the Role entity with id = 2. The permission attribute is of Set type, so I'm creating a join and selecting from it, but the query fails with invalid grammar exception reporting "Unknown column '2L' in 'where clause'"
The criteria query that...
Hi all,
I've been trying to create a criteria builder containing a belongsTo relation and have yet to succeed. Consider the following model:
class Msg {
...
static belongsTo = [user: User]
...
}
class User {
...
Organisation organisation
...
}
I'm trying to make the following query:
Msg.createCriteria()....