Does NHibernate support inline views using criterias? Google doesn't seem to return any relevant results. Here is the query I need to convert preferably using criterias.
SELECT COUNT (incident_count) AS incident_count,
SUM (total_customers) AS total_customers,
MAX (longest_etr) AS longest_etr,
COUNT (DISTINCT crew_c...
Hello everyone,
I'm trying to break the question down to something simple.
I use nhibernate to get a list of entities via a criteria call. After that I'll update some entites and add one entity which I save (session.SaveOrUpdate(entity)).
When I get a list with a criteria again I do get the entities that were changed (with changed valu...
Hi
In the mapping-file I've defined a bag for Positionen.
<class name="Animag.DomainModels.Models.Abrechnung, Animag.DomainModels" table="Abrechnungen" lazy="true">
<id name="ID" column="ID">
<generator class="native"/>
</id>
<version name="Version" column="Version"/>
<many-to-one name="Kunde" column="KundeID" c...
Hi
In the mapping-file I've defined a bag for Positionen.
<class name="Animag.DomainModels.Models.Abrechnung, Animag.DomainModels" table="Abrechnungen" lazy="true">
<id name="ID" column="ID">
<generator class="native"/>
</id>
<version name="Version" column="Version"/>
<many-to-one name="Kunde" column="KundeID" c...
I want to translate the following HQL into Criteria notation:
from Deal
where CURRENT_DATE between startDate and endDate
I tried using Restrictions.between but it doesn't recognize current_date
Criteria c = session().createCriteria(Deal.class)
.add(Restrictions.between("CURRENT_DATE", "startDate", "endDate");
...
Hi,
what is the method to create OR?
I mean: I know to craate this SQL clause:
SELECT * FROM author WHERE author.FIRST_NAME = 'Karl' AND author.LAST_NAME <> 'Marx';
I should do this:
<?php
$c = new Criteria();
$c->add(AuthorPeer::FIRST_NAME, "Karl");
$c->add(AuthorPeer::LAST_NAME, "Marx", Criteria::NOT_EQUAL);
$authors = AuthorPeer...
I try log some details in a namedQuery for a grails domain class but logging errors.
static namedQueries = {
firstThree {
if (booleanValue) {
log.trace "booleanValue = true"
eq ('bar', foo)
}
maxResults(3)
}
}
Error
No such property: log for class: grails.orm.HibernateCriteriaBuilder
How do I log in a ...
Hi,
I have this criteria propel.
public static function getPrenotazioniAttive($id_utente)
{
$c = new Criteria();
$c->add(self::USER_ID, 18793 );
$result = self::doSelect($c);
}
After that i add this:
echo $c->toString();
that shows:
Criteria: SQL (may not be complete): SELECT FROM `prenotazione` WHERE prenotazione.USER_ID=:p1 ...
Can some one suggets me how to build up following query using JPA Criteria builder api.
SELECT id,status,created_at from transactions where status='1'
and currency='USD' and appId='123' order by id
Its better if i can find a solution which creates dynamically based on the parameters given as a map using metamodel classes or any ot...
I'm wondering if is possible to convert this HQL query into a criteria api query.
select s1
from Student
where
(
select max(s2.Score)
from Student
where s1.Id = s2.Id
)
= 10
(selects the students that have their max score value equal to 10)
I don't know if I could use a detached criteria beca...
This might be a super easy answer, since I'm sure it's not uncommon. I see some similar questions, but nothing that seems to describe my problem.
I have two objects: a car and person. They're in a many-to-many relationship, i.e. a car can be owned by multiple people, and a person can own multiple cars. Car has a lazily initialized se...
Hi,
I have this query inside a method:
public static function pincopalla(){
$con = Propel::getConnection(SediI18nPeer::DATABASE_NAME);
$sql = "select * from sedii18n where culture = :country
UNION
select * from sedii18n where culture <> :country";
$stmt = $con->prepare($sql);
$result = $stmt->execute(a...
My object model is the following:
Item has many Tags and a Tag could belong to many Items
I'd like to execte the following query using criteria's.
SELECT * FROM Item item
where item.Id in (Select it.ItemId from dbo.ItemToTags it where it.Tag_id = 'ONE')
and item.Id in (Select it.ItemId from dbo.ItemToTags it where it.Tag_id = 'TWO')
...
Hi,
i have retrieved a group of elements using a propel criteria. Now are at $Sedi18ns
When i use this:
$SediI18ns->prev()
I get:
( ! ) Fatal error: Call to undefined
method
sfOutputEscaperArrayDecorator::prev()
No problems when i use next().
Any idea?
Regards
Javi
...
I have a CreateCriteria that adds a join to the same table twice with different aliases:
aCriteria.CreateCriteria("Color", "co").Add(Expression.In("co.ColorId", bikush.Color.Select(x => x.ColorId).ToList()));
aCriteria.CreateCriteria("Color","fco").Add(Expression.In("fco.ColorId",bikush.FCColor.Select(x => x.ColorId).ToList()));
I'm...
Hi,
I am looking for some advice on what the best approach to a hibernate Criteria query is. I have been looking around for a while and can't decide if I should follow an approach of left Joins and searching for and ID or using the Query By Example API (I haven't found any good tutorials for this yet so if anyone has any suggestions it...
I have a problem with SetFetchMode call in Criteria API in following query:
DetachedCriteria.For<User>()
.Add<User>(u => u.Status == UserStatus.Live)
.CreateAlias("UniqueId", "uid")
.CreateAlias("Companies", "comp")
.Add(Restrictions.Disjunction()
...
I have a domain like this:
class Project
{
...
Unit ProjectUnit
}
class Unit
{
...
IList<User> Users
}
class User
{
...
}
I have to get all projects based on one user, so: each Project where Unit.Users contain query user.
How can I translate this to a DetachedCriteria?
...
I have a DTO with 40+ properties. But in order to populate all properties I need to execute 4 separate queries. My first query is in charged of getting basic information. For each row returned I run 3 more queries based on the id's given from the main query (N+1 problem). I can set use eager loading but then I'm loading thousands of obje...
Hello,
i want to use hibernate to get record from db, such that it's with the max dbId, i tried to use projections, creating alias for 'max(dbId)', then using it in 'restrictions.eq', but it keeps telling me invalid number, i think this may be because it's an integer in db, and i mapped it as a string in my entity,
could any one help m...