[nhusers] Re: Intercepting hits to the database

2008-11-19 Thread gatapia
I considered this option, I don't really like it. I really wanted to integrate the logging of the counts of these queries in the application. So my request log (asp.net application by the way). Would be: Page: /foo/bar.aspx Took: 100ms # Transactions: 2 # Queries that hit the database: XXX Pag

[nhusers] Re: use like in hql

2008-11-19 Thread 杨小华
thank you! --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more opti

[nhusers] Re: Intercepting hits to the database

2008-11-19 Thread jerry porter
Why not try using log4net and turn on the "sql logging" attribute. Here is one example: Might be too bit verbose, but might satisfy your need. http://davesquared.blogspot.com/2008/01/viewing-sql-generated-by-nhibernate.html Jerry Porter - Original Message From: gatapia <[EMAIL P

[nhusers] Intercepting hits to the database

2008-11-19 Thread gatapia
Hi All, I was just wondering if I can intercept hits to the database? Basically I want to log how many times an asp.net request hits the database. I had a quick look at the source code and it looks like Batcher.LogCommand does exactly what I want but it is not intercepteable (no hooks). I've a

[nhusers] Re: Multiple Collections in class, not using discriminator value?

2008-11-19 Thread Jon Stelly
As an update, I made the following change and the discriminator is added to the WHERE clause for loading the Ds and Es collections. All of my other classes, mappings and queries seem to work. I'm going to do some more testing on this and try and run the NHibernate unit tests against this change,

[nhusers] Multiple Collections in class, not using discriminator value?

2008-11-19 Thread Jon Stelly
Hi, I think I've run into a bug in 2.0.1, but I haven't found anything in Jira and wanted to ask here before I posted a bug to make sure I'm not just doing something stupid. I've got a class hierarchy with a table per hierarchy mapping, and a class of type C that has 2 collections, One of type I

[nhusers] Re: Tuplizers

2008-11-19 Thread Lee Henson
Yes I have read both of those, and they have helped me get where I am now. I'm just interested in knowing what level of knowledge it is necessary for me to have of the underlying tuplizer/instantiator classes in order to use my own implementations? Do I need to code for optimizers etc? Che

[nhusers] Re: Best Practice: property access

2008-11-19 Thread Fabio Maulo
2008/11/19 Henning <[EMAIL PROTECTED]> > > So how is NH actually "injecting" the value into the object? If the > setter is private, it will not be available to NH, so does NH use > reflection to set the value? By default NH use reflection optimizer. -- Fabio Maulo --~--~-~--~~

[nhusers] Re: Tuplizers

2008-11-19 Thread Fabio Maulo
Check herehttp://fabiomaulo.blogspot.com/2008/10/less-than-few-is-gof.html http://fabiomaulo.blogspot.com/2008/10/entity-name-in-action-entity.html 2008/11/19 Lee Henson <[EMAIL PROTECTED]> > Hi > > I'm having a first attempt at implementing a custom tuplizer in order to > provide a required depe

[nhusers] Re: Best Practice: property access

2008-11-19 Thread Henning
So how is NH actually "injecting" the value into the object? If the setter is private, it will not be available to NH, so does NH use reflection to set the value? On 15 Nov., 12:58, FrederikGheysels <[EMAIL PROTECTED]> wrote: > As from C# 2.0, you're able to define different accessibility levels

[nhusers] Re: Best Practice: property access

2008-11-19 Thread Henning
at least, as long you're not using auto-properties from VS2008 On 14 Nov., 13:56, Tapio Kulmala <[EMAIL PROTECTED]> wrote: > Hi > > My favorite is field.camelcase-underscore. That way I can keep the > public interface of the entity clean. Don't have to publish > everything. > > Tapio > > On Nov 1

[nhusers] Re: Best Practice: property access

2008-11-19 Thread Henning
and how would I do that? And just for the "fun" of it ... can I do that with NH 1.2 as well? :) On 14 Nov., 13:50, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > You can have nosetter access strategy in conjunction with a naming strategy, > I think > > > > On Fri, Nov 14, 2008 at 2:47 PM, Tuna Toksöz

[nhusers] Tuplizers

2008-11-19 Thread Lee Henson
Hi I'm having a first attempt at implementing a custom tuplizer in order to provide a required dependancy to one of my entities. I want to create a generalised solution that will work for all entities automatically, as I add required dependencies over time. And I'll also take out the requirement f

[nhusers] Re: One-to-many or many-to-one advice

2008-11-19 Thread Mike Nichols
Yeah I agree...that is why I need a collection of IMaterialsTests on Sample and not a many-to-one on the IMaterialsTest=>Sample. I may be missing some other insight in the domain here... On Nov 19, 3:30 am, "Gabriel Schenker" <[EMAIL PROTECTED]> wrote: > In DDD the domain model is all that counts

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread David Mukaiwa
My advice is to read through (N)Hibernate in Action in tandem with the documentation to get a good feel of the main components of NHibernate. I would still read through the best practices Tuna recommended on codeproject (http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx). Now

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread 8bit
Will the helper utility in the reference manual suffice? And if so, is my "GetAllTags" method the proper way to use it? Public Function GetAllTags() As IList(Of String) Dim tags As IList(Of String) = Nothing Dim session As ISession = Utility.NHibernateUtil.GetCur

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread Fabio Maulo
2008/11/19 Roger Kratz <[EMAIL PROTECTED]> > > I got the impression that you recreate your IsessionFactory over and over > again for each request/every call to your data layer? Creating an > ISessionFactory is an expansive op. Create the instance in some start up > code for your web app and reuse

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread Fabio Maulo
google : NHibernate best practices 2008/11/19 8bit <[EMAIL PROTECTED]> > > Because I'm brand spanking new, an example would be greatly > appreciated. Thanks. > > On Nov 19, 8:23 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > > In web environment it is generally a best practice to open the sessio

[nhusers] Re: use like in hql

2008-11-19 Thread Fabio Maulo
CreateQuery("from Person p where p.Name like :MyParameter").SetString("MyParameter","%?%").List(); 2008/11/19 杨小华 <[EMAIL PROTECTED]> > Hi, > >I am new to use nhibernate. I need make a query like the following. > > hql: "from Person where 1 = 1 and Person.Name like %?%" > >I want to know

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread Roger Kratz
I got the impression that you recreate your IsessionFactory over and over again for each request/every call to your data layer? Creating an ISessionFactory is an expansive op. Create the instance in some start up code for your web app and reuse it. -Original Message- From: nhusers@goog

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread Tuna Toksöz
You can check http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx Check Burrow too, I think it has something to manage sessions. On Wed, Nov 19, 2008 at 3:27 PM, 8bit <[EMAIL PROTECTED]> wrote: > > Because I'm brand spanking new, an example would be greatly > appreciated. T

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread 8bit
Because I'm brand spanking new, an example would be greatly appreciated. Thanks. On Nov 19, 8:23 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > In web environment it is generally a best practice to open the session at > the beginning of the request and close it at the end. > > > > On Wed, Nov 19

[nhusers] Re: New, Need Help with ISession/Configuration

2008-11-19 Thread Tuna Toksöz
In web environment it is generally a best practice to open the session at the beginning of the request and close it at the end. On Wed, Nov 19, 2008 at 3:17 PM, 8bit <[EMAIL PROTECTED]> wrote: > > I'm just trying to get a grasp on the fundamentals here. I'm trying > to figure out the best way to

[nhusers] use like in hql

2008-11-19 Thread 杨小华
Hi, I am new to use nhibernate. I need make a query like the following. hql: "from Person where 1 = 1 and Person.Name like %?%" I want to know how to write like express in hql. Thank you. --~--~-~--~~~---~--~~ You received this message because you are

[nhusers] New, Need Help with ISession/Configuration

2008-11-19 Thread 8bit
I'm just trying to get a grasp on the fundamentals here. I'm trying to figure out the best way to configure the ISessionFactory/ISession for my ASP.NET application. I'm just afraid that I might be leaving some connection open or perhaps implementing this the wrong way. So, in my data layer, I h

[nhusers] Re: Custom SQL for sorting with criteria api

2008-11-19 Thread rashack
Hi Joe, In the current version of NH you can pass a Projection to the AddOrder bit. Give it a try. Hope this helps, Jarda On Nov 19, 3:11 am, joe <[EMAIL PROTECTED]> wrote: > Hi. > > I'm using the criteria to create composable queries. > I found it very clean and reusable but stuggle with advanc

[nhusers] Re: NHibernate Proxy not loading Id

2008-11-19 Thread rashack
Hi, I spent quite few bits investigating this...: http://jira.nhibernate.org/browse/NH-1574 And it seems there's the same core issue to that. I will put together an unit test to figure this out (when I find time this evening)... But just quickly from what I remember in PocoEntityTuplizer.BuildPr

[nhusers] Re: One-to-many or many-to-one advice

2008-11-19 Thread Gabriel Schenker
In DDD the domain model is all that counts. The database is only an implementation detail. We should not let ourselves limit by the database in my opinion. Restrictions (especially if some business logic is behind them) have to be enforced by the domain. I know, this is an extreme position but it m

[nhusers] one-to-one relations enforced by legacy database

2008-11-19 Thread Gabriel Schenker
often we encounter the situation where we have a pre-existing database (for me this IS a legacy database) and we have to adapt our domain model to this situation. How do I map this kind of relation in NHibernate? This question comes up again and again in this list. I have tried to show a possible