[nhusers] Re: Validator messages

2009-03-02 Thread Dario Quintana
Which feature ? {floor.out.of.range} is the name of a resource string, you can use it. On Mon, Mar 2, 2009 at 8:49 PM, Marc Climent wrote: > > Anyway, will this feature be available in the future? Can I do > something about it? > > -- Dario Quintana http://darioquintana.com.ar --~--~

[nhusers] Re: Validator messages

2009-03-02 Thread Marc Climent
Yes, I can do that. Anyway, will this feature be available in the future? Can I do something about it? I can see in the original Hibernate Validator documentation that the messages can be overriden with a properties file and with an Interpolator: http://www.hibernate.org/hib_docs/validator/refer

[nhusers] Mapping object relations to the same table

2009-03-02 Thread mhnyborg
Have can I map this NCP has a collection of Candidates Candidate has a collection of FO and not always an NCP parent The data is all in the same table. I am rewriting an old MS Access application and the application have the concept of a Nominal Cell Point (NCP) . A NCP have Candidates and an A

[nhusers] Re: Validator messages

2009-03-02 Thread Fabio Maulo
For base validators all resources are deployed with NHV.If you want, you can change the resource using a resource-editor (from microsoft of some other free). 2009/3/2 Marc Climent > > Hi Fabio. > > I know in the tag I can specify the message and as well in my custom > validators but I need local

[nhusers] Re: Validator messages

2009-03-02 Thread Marc Climent
Hi Fabio. I know in the tag I can specify the message and as well in my custom validators but I need localization. I see in the link examples this: WithMessage("{floor.out.of.range}") The "{floor.out.of.range}" message is somewhere defined? How can I use this kind of templates for message l

[nhusers] Question about parent - child relationship with multiple parents

2009-03-02 Thread Lena
Hello. I've come across a problem mapping my object model with nhibernate. I have the following object model: A top-level abstract class Element with many children and descendants. A class Event. Each Element contains a bag of Events. Each Event has a pointer to the parent Element. Up till now - p

[nhusers] Re: NHibernate.MappingException : Unable to instantiate specified event (PreUpdate) listener class:

2009-03-02 Thread Ramana Kumar
Oops I had to add the fully qualified name for the class... See the bolded text below... On Mon, Mar 2, 2009 at 1:28 PM, Ayende Rahien wrote: > System.TypeLoadException : Could not load type 'AuditEventListener' from > assembly 'GolfHandicapManager.Data, Version=1

[nhusers] Re: NHibernate.MappingException : Unable to instantiate specified event (PreUpdate) listener class:

2009-03-02 Thread Ramana Kumar
Oops I had to add the fully qualified name for the class... See the bolded text below... On Mon, Mar 2, 2009 at 1:28 PM, Ayende Rahien wrote: > System.TypeLoadException : Could not load type 'AuditEventListener' from > assembly 'GolfHandicapManager.Data, Version=1

[nhusers] Re: Question about Criteria

2009-03-02 Thread Tuna Toksoz
It is related with CriteriaLoader, and i can't say how hard it would be. Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 9:02 PM, David wrote: > > So if I said I wanted to implement tha

[nhusers] Re: NHibernate.MappingException : Unable to instantiate specified event (PreUpdate) listener class:

2009-03-02 Thread Ayende Rahien
System.TypeLoadException : Could not load type 'AuditEventListener' from assembly 'GolfHandicapManager.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. On Mon, Mar 2, 2009 at 9:33 AM, Ramana Kumar wrote: > Hi > I am getting the following exception when I am trying to register for >

[nhusers] Re: Question about Criteria

2009-03-02 Thread David
So if I said I wanted to implement that functionality, what would be the process? Is there a design for it already and it just needs to be written? I would be interested in working on it but I wouldn't want to waste time on an approach that wouldn't get included. --~--~-~--~~--

[nhusers] NHibernate.MappingException : Unable to instantiate specified event (PreUpdate) listener class:

2009-03-02 Thread Ramana Kumar
Hi I am getting the following exception when I am trying to register for "pre-insert"/"pre-update" Event. BTW, I am trying to use the OnPreInsert Event in 2.0.1 to insert CreatedBy, CreatedOn fields to each AudiatbleEntity. I did looked in the http://nhforge.org/wikis/howtonh/creating-an-audit-lo

[nhusers] Re: Question about Criteria

2009-03-02 Thread Tuna Toksoz
Because nobody implemented it, that's the only reason. Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 8:56 PM, David wrote: > > Yes I realize that it doesn't support it. I'm trying to

[nhusers] Re: Question about Criteria

2009-03-02 Thread David
Yes I realize that it doesn't support it. I'm trying to understand why. It just seems so basic to me that I can't come up with a good reason for it not being supported. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[nhusers] Re: Question about Criteria

2009-03-02 Thread Tuna Toksoz
Criteria cannot handle this, if i recall correct. Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 8:49 PM, David wrote: > SELECT t1.* > --~--~-~--~~~---~--~

[nhusers] Question about Criteria

2009-03-02 Thread David
I've been fighting with this for some time now and I would like to understand the reasoning behind it. I realize that NHibernate (Hibernate) Criteria doesn't support arbitrary joins on columns that are not related through a mapped association. My problem is that I don't understand why this isn't p

[nhusers] Re: Validator messages

2009-03-02 Thread Fabio Maulo
If what you need is only change the message you don't need the interpolator If you can use the NHV trunk... http://nhforge.org/blogs/nhibernate/archive/2009/02/18/nhibernate-validator-fluent-interface-configuration.aspx http://fabiomaulo.blogspot.com/2009/02/diving-in-nhibernatevalidator.html

[nhusers] Validator messages

2009-03-02 Thread Marc Climent
Hi, I've been using NHV and I need to change the "default" messages. I can't change the ValidatorEngine.Interpolator at runtime (I could create a DefaultMessageInterpolator and initialize it with a different bundle and pass it, but I can't and I think I shouldn't) and I can't configure the resou

[nhusers] Re: Linq to NHibernate : Replicating SQL Query

2009-03-02 Thread Tuna Toksoz
Absolutely. Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 7:36 PM, Bill Barry wrote: > better? > var companiers_that_use_supplier3 = session.Linq().Where > (c=>c.Suppliers.Any(x=>x==

[nhusers] Re: Linq to NHibernate : Replicating SQL Query

2009-03-02 Thread Bill Barry
better? var companiers_that_use_supplier3 = session.Linq().Where (c=>c.Suppliers.Any(x=>x==s)); Tuna Toksoz wrote: > just a guess > > var companiers_that_use_supplier3 = session.Linq() > .Where (c=>c.Suppliers.Count(x=>x==s)>0); > > > Tuna Toksöz > http://tunatoksoz.com > http://turkiyealt.net >

[nhusers] Re: Min and Max date ranges

2009-03-02 Thread sadiq.wa...@gmail.com
That should work for me as well because for Oracle, DateTime.MinValue and DateTime.MaxValue work. I don't know abou tthe other databases such as MySQL or PostGress. I would think that this would be a common problem and would have been great if hibernate provided soem utility function instead of

[nhusers] Re: Linq to NHibernate : Replicating SQL Query

2009-03-02 Thread Tuna Toksoz
just a guess var companiers_that_use_supplier3 = session.Linq() .Where (c=>c.Suppliers.Count(x=>x==s)>0); Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 6:21 PM, Chris wrote: > var c

[nhusers] Re: Min and Max date ranges

2009-03-02 Thread Will Shaver
http://www.primedigit.com/2008/12/02/sql-server-datetime-conversion/ Not explicitly an answer to your question, but I solved it for SQL server using the extension method here. On Mon, Mar 2, 2009 at 8:40 AM, sadiq.wa...@gmail.com wrote: > > I have soem classes that have dates as properties.  I

[nhusers] Min and Max date ranges

2009-03-02 Thread sadiq.wa...@gmail.com
I have soem classes that have dates as properties. I need to run a query in which I need to check to see if the date property is within the min and max range. Oracle and SqlServer seem to have different values for minimum and maximum dates and those are different than the DateTime.MaxVale and Da

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Tuna Toksoz
My guess is that you can have different function implementations for different dialects by registering your function RegisterFunction("lower", new StandardSQLFunction("lower")); This is what I see in some dialect, and my guess is that first "lower" is what NH sees, and second "lower" is its corre

[nhusers] Linq to NHibernate : Replicating SQL Query

2009-03-02 Thread Chris
I have the following query in SQL SELECT company.* FROM company c WHERE EXISTS (SELECT * FROM company_suppliers WHERE supplier_id = @supplier_id) and am trying to recreate it in Linq To NHibernate, now the natural sytax is something like Supplier s = session.Get(3); var companiers_that_use_sup

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Colin Ramsay
I just implemented a save event which automatically updates a NextUploadDue property and then I can run a criteria against that. On Mar 2, 2:51 pm, Colin Ramsay wrote: > Turns out DateDiff is indeed different between the two so it won't > work in my situation. Bugger. > > On Mar 2, 1:53 pm, Coli

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Colin Ramsay
Turns out DateDiff is indeed different between the two so it won't work in my situation. Bugger. On Mar 2, 1:53 pm, Colin Ramsay wrote: > Thank you Tuna! > > On Mar 2, 1:34 pm, Tuna Toksoz wrote: > > > I have no idea, it all depends on the functions, and its specific syntax. > > but in general,

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Colin Ramsay
Thank you Tuna! On Mar 2, 1:34 pm, Tuna Toksoz wrote: > I have no idea, it all depends on the functions, and its specific syntax. > but in general, it should work, or i hope it will work. > > Tuna > Toksözhttp://tunatoksoz.comhttp://turkiyealt.nethttp://twitter.com/tehlike > > Typos included to

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Tuna Toksoz
I have no idea, it all depends on the functions, and its specific syntax. but in general, it should work, or i hope it will work. Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 3:33 PM,

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Colin Ramsay
Would that work even if I switched my config from SqlServer to MySQL - i.e. does it depend on database-specific syntax? On Mar 2, 1:25 pm, Tuna Toksoz wrote: > You can use SqlFunctionProjection together with GreaterThan. > Is that clear? > > Tuna > Toksözhttp://tunatoksoz.comhttp://turkiyealt.n

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Tuna Toksoz
I guess it is a bit long Restrictions.GeProperty(Projections.SqlFunction("DateDiff",NHibernateUtil.Boolean, Projections.Constant("hh"), Projections.Property("LastUploaded"), Projections.SqlFunction("GetDate",NHibernateUtil.Date)),"UploadFrequencyInHours") I am not

[nhusers] Re: Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Tuna Toksoz
You can use SqlFunctionProjection together with GreaterThan. Is that clear? Tuna Toksöz http://tunatoksoz.com http://turkiyealt.net http://twitter.com/tehlike Typos included to enhance the readers attention! On Mon, Mar 2, 2009 at 3:05 PM, Colin Ramsay wrote: > > Hi all, > > Given this data:

[nhusers] Re: When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Fabio Maulo
@GrahamWhat Roger said is one more point a little bit more deeper... BTW for a full answer about what happen each time you are doing something with an instance of ISession would require a book. The better attitude for a NH's beginner is : read reference, buy "NHibernate in Action", enjoy it. After

[nhusers] Re: When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Fabio Maulo
2009/3/2 Graham Bunce > > As I was writing that, I suspected it needed to know the key which, of > course, it doesn't - so just to clarify, if I did a Load by key, the > 1st level cache will be checked, otherwise it won't? That was only the quick answer, as you can imagine a real answer would

[nhusers] Re: When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Roger Kratz
<< so just to clarify, if I did a Load by key, the 1st level cache will be checked, otherwise it won't?>> FYI ISession is also an identity map (http://martinfowler.com/eaaCatalog/identityMap.html), ensuring no duplicate instances exists in one ISession/uow. This check of the state in ISession

[nhusers] Criteria Question - How to Compare Against Another DB Value?

2009-03-02 Thread Colin Ramsay
Hi all, Given this data: Feed includedFeed = new Feed { LastUploaded = DateTime.Now.AddHours(-6), UploadFrequencyInHours = 5 }; Feed excludedFeed = new Feed { LastUploaded = DateTime.Now, UploadFrequencyInHours = 5 }; I would like to query the database using the criteria API to

[nhusers] Re: When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Graham Bunce
Thanks Fabio. As I was writing that, I suspected it needed to know the key which, of course, it doesn't - so just to clarify, if I did a Load by key, the 1st level cache will be checked, otherwise it won't? 2nd level cache eh? Looks like I'm going to be learning how to use yet another feature

[nhusers] Re: When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Fabio Maulo
The session-cache is used only when the entityIdentity is know.When you execute a query NH hit DB for the whole query, then, before create each entity instance, NH hit the session-cache to know if some one is available in which case the available instance will be used. If you want cache a entirely

[nhusers] When/how does NHibernate check its 1st level cache?

2009-03-02 Thread Graham Bunce
Hiya, A developer on my team raised an issue today and it threw me a little as the behaviour he reported wasn't was I was expecting. He is running through a loop, doing an HNibernate Linq query (which resolves down to a Critera query). Based on the results he either adds or updates then, once al