hi, i need to know if a select returns at least one result.
the select with nhibernate is
Session.CreateCriteria(typeof(MyEntity))
.Add(Expression.Eq("Name", name));
.List<MyEntity>();
I need to know if that select will return at least one result, the
table is very big so i don't use Count(***) > 0
but i'm using the EXISTS function wich will break when the select get
the first result.
currently i'm using directly a sql query (FIREBIRD)
SELECT 1 FROM rdb$database WHERE EXISTS(SELECT * FROM MyEntityTable
WHERE NAME = :Name)
wich will return 1 if the select will returns at least 1 result or no
data if no result exist.
Can i get the same behaviour using icriteria (or hql if i can only
with it)?
NOTE: i don't need to get the exact result of my sql query, for
example i can also get 0 if results count is 0, 1 otherwise, the
important thing is to use exists to sudden break when a matching
record is found.
thanks
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.