[nhusers] Re: getting the parent and number of child entities

2009-10-29 Thread Oskar Berggren
Shouldn't size(s.E...) be count(elements(s.E...)) in that case? There seems to be examples along those lines in the docs. Drawback is you have to specify all properties of s in the group by. /Oskar 2009/10/29 Fabio Maulo fabioma...@gmail.com: That is not the best domain to make an example

[nhusers] SetFetchMode on ICriteria

2009-10-29 Thread Nexus
Hi, According to the nhibernate documentation in the source FetchMode.Select (equals Lazy) and should /// summary /// Fetch eagerly, using a separate select. Equivalent to /// cfetch=select/c (and couter-join=false/c) /// /summary But this does nothing, so it is not the same as fetch=select in

[nhusers] Re: Performance implications of returning a large number of columns

2009-10-29 Thread reach4thelasers
I know this but what I am saying is that if my objects have a large number of properties and a few joins between objects then the resulting SQL that NHibernate produces contains a large number of columns (most of which I don't need). I just want to know if this has any performance

[nhusers] Re: refresh a single object

2009-10-29 Thread Fabio Maulo
do you have a test ? 2009/10/28 Ralph Balck ra...@tbalck.com Hi, I have a form with a cancel button. When the user hits the cancel button, i would like to abandon any changes to this object and reload/ refresh the data from the database. I tried Refresh(object), but it keeps all of my

[nhusers] Re: getting the parent and number of child entities

2009-10-29 Thread Fabio Maulo
Good alternative... Michal, as you can see, to have a good solution people need a better explanation. ;) 2009/10/29 Oskar Berggren oskar.bergg...@gmail.com Shouldn't size(s.E...) be count(elements(s.E...)) in that case? There seems to be examples along those lines in the docs. Drawback is

[nhusers] Re: Linq to NH bug report

2009-10-29 Thread NickNH
Thank you. Your workaround works too and is of course better than mine. *It still remains a major issue though, if it's confirmed a bug.* YES Nicolas On Oct 28, 10:16 pm, Mohamed Meligy eng.mel...@gmail.com wrote: Yes, I read that part wrong last time. Sorry. Did you try this work around?

[nhusers] Re: Linq to NH bug report

2009-10-29 Thread NickNH
Thank you. Your workaround works too and is of course better than mine. *It still remains a major issue though, if it's confirmed a bug.* YES Nicolas On Oct 28, 10:16 pm, Mohamed Meligy eng.mel...@gmail.com wrote: Yes, I read that part wrong last time. Sorry. Did you try this work around?

[nhusers] Re: Sql Server Executions Plans Still Not Working with prepare_sql = true?

2009-10-29 Thread zvolkov
Ok, implemented these changes in the next version of my app, goes to PROD around New Year. On Oct 29, 12:09 am, Fabio Maulo fabioma...@gmail.com wrote: 2009/10/29 zvolkov zvol...@gmail.com Fabio, my point is: if SQLServer is changed to always call SetParameterSizes and SetParameter does

[nhusers] Update ID of entity after save

2009-10-29 Thread Kent Boogaart
Hi, I feel like I must be missing something obvious. I'm using 2.1.0.GA. I have code that saves an entity with ID mapped as: id name=Id type=int unsaved-value=0 generator class=native/ /id The entity is successfully saved, but its Id property remains as zero afterwards. How can I have

[nhusers] NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

2009-10-29 Thread lcorneliussen
Hi all together! I'm sure I am missing something, but shouldn't each entity in a list, when queried via the criteria API, be a proxy that enables lazy loading? I posted my question on stack overflow. The code is more readable over there:

[nhusers] Re: Lazy loading in a reattached entity does not work

2009-10-29 Thread Vivien
I have exactly the same issue, but i really can't enable save-or- update cascade on all the places where i have this problem. Do you have any alternative to have the lock() method, to reattach proxy of the sub-objects to the session ? This problem doesn't exist in NH 1.2, and seems to have

[nhusers] Problème with proxy when reattaching objec t to the session.

2009-10-29 Thread Vivien
Hi, We migrate recently to the new NHibernate 2.1, and meet a unique, but really problematic issue. This is working perfectly in NHibernate 1.2 but not in 2.1. In NH 2.1, session.lock() is not reattaching the proxies of the sub objects. . i would like to know if it's possible to

[nhusers] Re: Linq to NHibernate and date function

2009-10-29 Thread Steve Strong
I believe this should work just fine in the new Linq provider that's in the trunk. I assume that you're using the criteria-based provider with the latest release? Steve Twitter Blog NHibernate Professional Support On 28 Oct 2009, at 15:42, Fabio Margarito wrote: Some tip? On 27 out,

[nhusers] Re: The query performance of the LINQ provider is atrocious

2009-10-29 Thread Steve Strong
Due to the nature of Linq, having a large number of tests is pretty much essential to have confidence that 1) the provider can handle most scenarios and that 2) when the provider is modified, we don't break existing code. Right now, the only test fixture that I've ported over from nhcontrib

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Dan Normington
Check out this link. It seems to provide information on how to implement this: http://nhforge.org/blogs/nhibernate/archive/2009/02/09/nh2-1-0-new-generators.aspx From: Kent Boogaart ken...@internode.on.net To: nhusers nhusers@googlegroups.com Sent: Thu,

[nhusers] Re: Linq to NHibernate and date function

2009-10-29 Thread José F . Romaniello
Maybe, this is an Off-Topic Steve. There is a problem in the new linq provider within an scenario like this: invoices.Where(i = i.Date == null) is failing because it generates a: select from invoice where invoice.Date = null instead of : select from invoice where invoice.Date is

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Kent Boogaart
Thanks Dan, but what exactly are you suggesting I change? Nothing in that link tells me what I should be doing to have my entity updated automatically with its ID. I'm using SQL2005 if it makes any difference, which presumably it shouldn't with NH. Thanks, Kent On Oct 29, 2:26 pm, Dan

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Fabio Maulo
I'm pretty sure you are talking about an aggregation class where we are avoiding some roundtrip we like avoid roundtrips but if you are using identity we must do, at least, a roundtrip at session.Save and... you are breaking the UnitOfWork pattern, nullifying the batcher and so on...

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Dan Normington
Kent,   I think all you have to do is change the generator class. You currently have it set to native. I personally haven't used Identity types in NHibernate, but I think the following should work: generator class=identity/ From: Kent Boogaart

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Fabio Maulo
native=identity is the Dialect saying that the RDBMS supports identity 2009/10/29 Dan Normington dnorm...@yahoo.com Kent, I think all you have to do is change the generator class. You currently have it set to native. I personally haven't used Identity types in NHibernate, but I think the

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Kent Boogaart
@Dan: no, I tried that and the Id property still isn't updated. @Fabio: all I want is to know what the ID is for my saved entities. If NH doesn't do it for me, it seems my alternative is to do a far less efficient and less reliable query that matches and multiple fields. So, I'm using the

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Fabio Maulo
Use session.Persist instead session.Save 2009/10/29 Kent Boogaart ken...@internode.on.net @Dan: no, I tried that and the Id property still isn't updated. @Fabio: all I want is to know what the ID is for my saved entities. If NH doesn't do it for me, it seems my alternative is to do a far

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Kent Boogaart
Aha! That seems to have done the trick. That said, I was using session.Merge rather than session.Save, and I remember I was using it for a good reason, but I can't remember what that reason was at the moment... Thanks guys, Kent On Oct 29, 2:52 pm, Fabio Maulo fabioma...@gmail.com wrote: Use

[nhusers] Re: Update ID of entity after save

2009-10-29 Thread Fabio Maulo
There isn't a trick. /// summary /// Make a transient instance persistent. This operation cascades to associated /// instances if the association is mapped with ttcascade=persist/tt.br/ /// The semantics of this method are defined by JSR-220. /// /summary /// param name=obja transient instance to

[nhusers] Re: NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

2009-10-29 Thread Diego Mijelshon
Short answer: no. Diego On Thu, Oct 29, 2009 at 11:22, lcorneliussen l...@corneliussen.de wrote: Hi all together! I'm sure I am missing something, but shouldn't each entity in a list, when queried via the criteria API, be a proxy that enables lazy loading? I posted my question on

[nhusers] Re: The query performance of the LINQ provider is atrocious

2009-10-29 Thread José F . Romaniello
Steve, thank you for such a good answer!. I'm following this for learn, not just for learn to code, but for learn the management and the decisions. And I'll submit the patch as you said soon! 2009/10/29 Steve Strong srstr...@gmail.com Due to the nature of Linq, having a large number of tests is

[nhusers] Re: NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

2009-10-29 Thread Fabio Maulo
lazy=extra and some specific indexed collection (for example map IDictionary). 2009/10/29 Diego Mijelshon di...@mijelshon.com.ar Short answer: no. Diego On Thu, Oct 29, 2009 at 11:22, lcorneliussen l...@corneliussen.de wrote: Hi all together! I'm sure I am missing something, but

[nhusers] Don't log query parameters values which are attached to binary fields

2009-10-29 Thread DomZ
Hi, NH use log4net to send logs, so we can get SQL queries with parameters ... The thing is that if the query contains binary fields and you put a big file, the log will be very big (at least the size of the binary file). It could be great to have a flag to tell to NH to don't return the

[nhusers] Re: NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

2009-10-29 Thread Diego Mijelshon
You're correct... that's the long answer :-) But unless you specify that, the answer to shouldn't each entity in a list, when queried via the criteria API, be a proxy is no, as that's not the default behavior, nor the expected behavior with his mapping and query. Diego PD: quedó largo el

[nhusers] Is there a way to mark an object as NOT dirty?

2009-10-29 Thread Jon Kruger
I have a situation where I need to load part of an object graph using custom SQL (for performance reasons). So I load up this collection using my custom SQL (ISession.CreateSQLQuery()) and then I assign that list to a property on another entity object. The problem is that when I assign the list

[nhusers] Re: Mapping with Timestamp. Miliseconds not persisted.

2009-10-29 Thread Paco Wensveen
Because a timestamp is the number of whole seconds since 1970. On Wed, Oct 28, 2009 at 8:21 PM, Edierley edier...@gmail.com wrote: Hi everybody, how are you? I'm here using nhibernate with C# and OracleServer Express. I mapped a class but it is not persisting the miliseconds, i'm using

[nhusers] Re: Is there a way to mark an object as NOT dirty?

2009-10-29 Thread Fabio Maulo
you should use a collection loader in the mapping instead CreateSQLQuery. btw what you want do is possible http://fabiomaulo.blogspot.com/2009/03/ensuring-updates-on-flush.html http://fabiomaulo.blogspot.com/2009/03/ensuring-updates-on-flush.htmlThe actualized implementation is available in

[nhusers] Re: NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

2009-10-29 Thread Fabio Maulo
I never seen his mapping I can jump in another place to see an answer but not to read a question nor how recreate an issue. 2009/10/29 Diego Mijelshon di...@mijelshon.com.ar You're correct... that's the long answer :-) But unless you specify that, the answer to shouldn't each entity in a

[nhusers] Re: Automatically create database if it does not exist

2009-10-29 Thread Dmitiry Nagirnyak
Yeah. I see what you mean here. And I went the same way. So I suppose at this stage it should be alright to do it using custom SQL from create database. Thanks a lot for your time spent for this question. Cheers. 2009/10/28 José A. Salvador Vanaclocha joans...@gmail.com So sorry but I don't

[nhusers] Save object fetched from different H ISssion - Is it possible?

2009-10-29 Thread Mohamed Meligy
This mostly applies to web applications. Let's say I have an object ShoppingCart that is persisted both in HTTP SessionState and Database for some reason (let's say we want the user to find the cart available if he leaves the site and comes back later). Every time the user adds a Product to the

[nhusers] Different between NH 1.2 and 2.1

2009-10-29 Thread Stefan Sedich
Just curious about the below: I have the below mappings: hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 namespace=Common assembly=Common class name=Arm table=Arms id name=Id column=Id generator class=assigned / /id property name=Desc type=String not-null=true / /class

[nhusers] Re: Different between NH 1.2 and 2.1

2009-10-29 Thread Fabio Maulo
yes, you should use Load instead a new obj with only id. 2009/10/29 Stefan Sedich stefan.sed...@gmail.com Just curious about the below: I have the below mappings: hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 namespace=Common assembly=Common class name=Arm table=Arms id

[nhusers] Re: Different between NH 1.2 and 2.1

2009-10-29 Thread Stefan Sedich
Cool thanks Fabio I gathered this much, do you know what changed that breaks this? Just out of curiosity really. Cheers Stefan On Fri, Oct 30, 2009 at 3:49 PM, Fabio Maulo fabioma...@gmail.com wrote: yes, you should use Load instead a new obj with only id. 2009/10/29 Stefan Sedich

[nhusers] Re: Save object fetched from different H ISssion - Is it possible?

2009-10-29 Thread Fabio Maulo
session.Lock or Merge; Merge if the entity was saved in some moment. btw there are some other options to manage that situation without use HttpSession 2009/10/29 Mohamed Meligy eng.mel...@gmail.com This mostly applies to web applications. Let's say I have an object ShoppingCart that is