Have a look here:
http://nhforge.org/doc/nh/en/index.html#querycriteria-associations
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegr
I would start with something like this:
session.CreateCriteria(customerType, "c")
.CreateAlias("c.Invoices", "i" )
.CreateAlias("c.Orders", "o" )
.Add(Expression.Or(Expression.Gt("i.Amount", 20.0), Expression.Gt
("o.Total", 10)));
--
Wolfgang
--~--~-~--~~
Try
.SetFetchMode("c.Category", FetchMode.Eager) _
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this
You have to use CreateCriteria/CreateAlias to create a subcriteria for
the associated object:
nhibernateSession.CreateCriteria(GetType(Parent), "p") _
.CreateCriteria("p.Child", "c") _
.Add(Expression.Sql("c.ChildProperty like '%)) _
--
Wolfgang
--~--~-~--~~--
Isn't a simple "like" doing the trick ? At least with SQL Serve it's
case-insensitive:
... Add(Expression.Like("Foo", "Bar") ...
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post
Try:
session.CreateCriteria(typeof(C), "c").CreateCriteria("c.ListOfB",
"b").Add(Expression.Property("b.class", typeof(S1)));
I'm not sure if this is supported with criterias. Maybe you have to
change typeof(S1) to string.
--
Wolfgang
--~--~-~--~~~---~--~~
You
SessionFactory has multiple methods to access the mapping data:
GetAllClassMetadata()
GetAllCollectionMetaData()
GetClassMetadata()
GetCollectionMetaData()
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
You can map it as a simple collection or do I miss something ?
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googl
If you switch to ICriteria, you can do these kind of queries. It may
depend on the inheritance strategy, but at least with one-table-per-
hierarchy it's working (maybe accidentally, but still useful)
ICriteria crit = session.CreateCriteria(typeof(Cat),"c").Add
(Expression.Eq("c.Fat", false));
IB
Than have a look at the filter mechnism of hibernate. You can enable/
disable the filter for each session. In your case you would enable the
filter for the first method and disable it for the second.
--~--~-~--~~~---~--~~
You received this message because you are su
I don't quite get your point ? In one case you want to load just a
subset of the collection and in another you need the complete
collection ?
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" grou
If this is the only reason why you want to use a custom sql for
collection loading, try hibernate filter instead:
http://nhforge.org/doc/nh/en/index.html#filters
They provide a very powerful interface for dynamic collection loading.
--
Wolfgang
--~--~-~--~~~---~--~--
You can add a where clause to the mapping:
or you can chech out hibernates filter mechanism if you more
flexibility:
http://nhforge.org/doc/nh/en/index.html#filters
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Afaik you can only project properties (e.g. "a.Street") and not
entities. What exactly do you want to get ?
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send ema
Try:
criteria.CreateAlias("Comments", JoinType.LeftOuterJoin, "c");
criteria.SetProjection(
Projections.ProjectionList()
...
.Add(Projections.Count("c.Id"))
);
--
Wolfgang
--~--~-~--~~~---~--~---
The SQL looks more or less like what I expected. What's wrong with
it ? Probably the articles belonging to the main node are missing
because they are not part of the statement. You're only selecting
articles from the child nodes.
--~--~-~--~~~---~--~~
You received t
Have you tried:
"from Article a where a.Section.Node in (select elements
(nod.ChildNodes) from
Node nod where nod.Id = :nodeId)" ?
Can you post the relevant parts of the mappings ?
--
Wolfgang
--~--~-~--~~~---~--~~
You received this message because you are subscr
17 matches
Mail list logo