[nhusers] Re: criteria

2009-09-06 Thread dummerchen
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

[nhusers] Re: problems building criteria

2009-08-18 Thread dummerchen
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 --~--~-~--~~

[nhusers] Re: CreateCriteria statement

2009-08-12 Thread dummerchen
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

[nhusers] Re: CreateCriteria statement

2009-08-04 Thread dummerchen
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 --~--~-~--~~--

[nhusers] Re: WHERE UPPER(foo) = 'BAR' Criteria

2009-07-20 Thread dummerchen
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

[nhusers] Re: Criteria and Sub-Class

2009-07-07 Thread dummerchen
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

[nhusers] Re: Extract Mapping Information during Runtime

2009-07-07 Thread dummerchen
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

[nhusers] Re: Advanced mapping - Is it at all possible when a single table contains tree of objects?

2009-07-07 Thread dummerchen
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

[nhusers] Re: Concrete class properties needed in HQL

2009-07-06 Thread dummerchen
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

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread dummerchen
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

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread dummerchen
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

[nhusers] Re: Collection loader with more than one parameter

2009-06-29 Thread dummerchen
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 --~--~-~--~~~---~--~--

[nhusers] Re: Filter/Sort on loaded collection

2009-06-28 Thread dummerchen
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

[nhusers] Re: Criteria API Projections

2009-06-24 Thread dummerchen
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

[nhusers] Re: How to convert HQL to Criteria

2009-06-23 Thread dummerchen
Try: criteria.CreateAlias("Comments", JoinType.LeftOuterJoin, "c"); criteria.SetProjection( Projections.ProjectionList() ... .Add(Projections.Count("c.Id")) ); -- Wolfgang --~--~-~--~~~---~--~---

[nhusers] Re: unindexed collection issue in complex hql query

2009-06-15 Thread dummerchen
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

[nhusers] Re: unindexed collection issue in complex hql query

2009-06-15 Thread dummerchen
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