Try:
criteria.CreateAlias(Comments, JoinType.LeftOuterJoin, c);
criteria.SetProjection(
Projections.ProjectionList()
...
.Add(Projections.Count(c.Id))
);
--
Wolfgang
--~--~-~--~~~---~--~~
I would have used an meaninless ID if I could, my problem is that I'm
making an distributed solution, where the object is saved on the
client and then uploaded to an central server.
In the first scenario when the object is saved on the client all works
fine, but when I want to upload it to the
Hi.
My database schema has quite some references and in order to avoid
loading always a great part of the wohle object graph I would like to
get some of the often used detail data directly in the entity without
denormalizing the schema.
Two concrete examples: In the following mappings the class
Hello all.
I have some questions about a subject that I simply cannot wrap my
head around...
My setup is as follows:
I have three entity types called Shopper, ShoppingList and
ShoppingListItem arranged in an aggregate like this:
Shopper (Has a collection of
I found a way to do it in HQL:
IQuery query = NHibernateHelper.GetCurrentSession()
.CreateQuery(from Square as s where s not in (select
s from Square as s left join s.Items as i where i.ItemId = :ItemId));
query.SetParameter(ItemId, ItemId);
Is this a good solution?
You can do this with Criteria+DetachedCriteria...
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Tue, Jun 23, 2009 at 11:50 AM, csetzkorn c.setzk...@liv.ac.uk wrote:
Is this a good solution?
I have decided to get the HQL working. Any ideas why this:
IQuery query = NHibernateHelper.GetCurrentSession()
.CreateQuery(from Square as s where s not in (select
s from Square as s left join s.Items as i where i.ItemId = :ItemId )
order by :order)
Thanks Wolfgang.
That worked. I kept thinking that I did not have to supply the c.Id
as the HQL can count the collection with just count(p.Comments).
Much appreciated.
On Jun 23, 2:14 am, dummerchen wolfg...@wollinet.com wrote:
Try:
criteria.CreateAlias(Comments, JoinType.LeftOuterJoin, c);
Hi,
We need to use the Sql Server CONTAINSTABLE() function from NHibernate
and the way we have done this in the past is to wrap it in a Table
Value Function (TVF) and then join on this.
Is there a way to use TVFs from NHibernate to map to a type? We will
need to join on the TVF and create
Yes.
A parameter is a value and not a string injection.
2009/6/23 csetzkorn c.setzk...@liv.ac.uk
I have decided to get the HQL working. Any ideas why this:
IQuery query = NHibernateHelper.GetCurrentSession()
.CreateQuery(from Square as s where s not in (select
s from Square
But how about the second time you want to save the entity in a new
database, and you want the id's to be the same, or maybe I dont want
to have the same Id, I maybe should have an uniqe id for my receipt
and another one for the db's which in this case could be different,
So when I upload my
2009/6/23 joshlrogers joshlrog...@gmail.com
1. If I go to using IoC for my session management I still do not see
how that takes care of possible orphaned sessions or prematurely
closed sessions.
Orphaned ?
CpBT do it trough SessionWrapper.
2. If I use one very long session through the
Hi Folks,
the title says it all really, we're trying to add NHibernate to a
rather fragile legacy application which still uses those versions, is
it possible to get NHibernate to work with them? If so where could I
find solution/project files to build it?
(refactoring to MSVC 2008/.NET 2 is
I'm having trouble with a joined-subclass mapping within my domain
model using NHibernate.
I have an abstract class ProjectMedia with some properties, and 2
concrete classes that inherit from this class, ProjectImage and
ProjectVideo. These map to tables ProjectMedia, ProjectImage and
Sorry I do not understand. This does not work too:
IQuery query = NHibernateHelper.GetCurrentSession()
.CreateQuery(from Square as s where s not in (select
s from Square as s left join s.Items as i where i.ItemId = :ItemId )
order by :order)
.SetParameter(ItemId,
NH1.2.1 was the last supporting NET1.1and the next coming soon NH2.1.x will
be the last series for .NET2.0
Luckily we can't stop the human progress.
2009/6/23 RobinP robin.pell...@gmail.com
Hi Folks,
the title says it all really, we're trying to add NHibernate to a
rather fragile legacy
Niclas,
In my opinion your application is going down the wrong path. Do you really
want your distributed server piece to be just a database store. When it
receives a message it saves it to the database regardless of what it is
sent? This sounds dangerous to me. Why not build your application a
m mixing things...formula + HiLo : formula is for db-side values -
HiLo is app-side values mixed with db-side each X times.
property is an incremented Int64 based on another property in the component
in the same table :
tables does not have properties, table has columns. If you need a value
Hmmm... you may have to push this into a build step that generates your mapping
files. So your formula would look something like this:
property name=MetaTrainName formula=(SELECT SomeField FROM
${Qualify('MyTableName')})/
Then you could have an NAnt target that would set up brail or some
I have an entity that is like this
public class Customer
{
public Customer() { Addresses = new ListAddress(); }
public int CustomerId { get; set; }
public string Name { get; set; }
public IListAddress Addresses { get; set; }
}
And I am trying to query it using the Criteria API
Ahh ok, thanks for clarifying Fabio.
On Jun 23, 3:05 pm, Fabio Maulo fabioma...@gmail.com wrote:
Yes the post was about should't appear a IRepositoryT...What is really
strange is that implementation was published by EntityFramework team.
2009/6/22 Paul Batum paul.ba...@gmail.com
Maybe
There is an if as well, but I left out for brevity.
if (!String.IsNullOrEmpty(criteria.Search))
{
query.Add(Expression.Or(
Expression.Like(Name, criteria.Search, MatchMode.Start),
Expression.Like(a.Address,
22 matches
Mail list logo