[nhusers] Re: Use NHibernate.Linq to get single entity with eager load

2009-08-14 Thread Jeffrey Zhao
http://ayende.com/Blog/archive/2009/07/26/nhibernate-linq-1.0-released.aspx Well, NHibernate Linq is officially released and in ayende's article he said "NHibernate’s Linq support has been tested (in production!) for the last couple of years, and most people find it more than sufficient for thei

[nhusers] Re: Use NHibernate.Linq to get single entity with eager load

2009-08-14 Thread 江名峰
老赵, I think the current version of NHibernate.Linq not use it in a production environment, if the two ways for writing the generated SQL is the same, and has been the object is different, then the problem is the Linq 2009/8/15 Jeffrey Zhao > Hello, I met a problem when use NHibernate.Linq to ge

[nhusers] Re: Some questions about Session Management

2009-08-14 Thread Fabio Maulo
Session in httpSession is for some special cases in an application and should be avoided.Session in httpSession would be useful for some application where the amount of users is really little (compared with what we are waiting for a real WEB applications; my optimistic estimation is < 1000 that inc

[nhusers] Re: Seems like 2.1 GA still has this bug?

2009-08-14 Thread Fabio Maulo
But that is not a bug, it is a sub-task with patch 2009/8/14 Niclas Pehrsson > > http://nhjira.koah.net/browse/NH-1827 > > > -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To pos

[nhusers] Use NHibernate.Linq to get single entity with eager load

2009-08-14 Thread Jeffrey Zhao
Hello, I met a problem when use NHibernate.Linq to get single entity with eager load. For example I've a the models like: public class Product { ... } public class Product { public virtual int ProductID { get; set; } public virtual string Name { get; set; } public virtual ISet Propert

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Jeffrey Zhao
Everything's fine after creating an bi-directional association with an IList in model. Thanks, Stefan. Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter: http://twitter.com/jeffz_cn -- From: "Jeffrey Zhao" Sent: Friday, August 14, 2009 10:27 PM

[nhusers] Re: Entity "version" update happening after Commit - not Flush?

2009-08-14 Thread Luke Bakken
Well, you could build the DTOs after the commit, since the Session would still be open. In the example code I provided, here's how the version is set: using (ISession s = sessionFactory.OpenSession()) { using (ITransaction t = s.BeginTransaction())

[nhusers] Seems like 2.1 GA still has this bug?

2009-08-14 Thread Niclas Pehrsson
http://nhjira.koah.net/browse/NH-1827 --~--~-~--~~~---~--~~ 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 nhuse

[nhusers] Re: Some questions about Session Management

2009-08-14 Thread Humberto Marchezi
Several requests from different users would use the method at a time since it is static. However there is one ASP.NET session per user and one user can only trigger one event at a time. Would still be a problem ? Another question: Suppose I decide to use Session Management provided by NH v 1.2 wit

[nhusers] Re: splitting big tables and entity-name feature

2009-08-14 Thread ReverseBlade
If you have 50 million of records then this solution is not feasible imho, that's why I am trying to split it. On Aug 14, 4:34 pm, Stefan Steinegger wrote: > Why not simply: > > IList result = session >   .CreateQuery("select m.Text from Message where m.Read = false > and ...") >   .List(); > >

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Jeffrey Zhao
Thanks for your reply, but it seems that I have to map Property as entitis since I need to get a single Property, modify and submit the changes of it. I tried the mapping: but it seems that NH won't only pro

[nhusers] Re: criteria problem

2009-08-14 Thread wa...@codingvista.com
oop it's an easy one ye!! query = query.Where(criterion); :s On Aug 14, 2:49 pm, Wayne Douglas wrote: > hi i've ran into a problem with the following code: > > > IList>> criteria = new > List>>(); > var sn = incommingUser.ScreenName; > criteria.Add(user => user.Name == username); > >

[nhusers] Re: Some questions about Session Management

2009-08-14 Thread Tuna Toksoz
NH session in HttpSession is not a good idea in that case. Several requests using the same session at the same time will yield in an exception in your case. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike

[nhusers] Some questions about Session Management

2009-08-14 Thread Humberto Marchezi
Hi, I have seen a lot of examples about session management where the idea is trying to hide the ISession from the application ( as far as I understood ). However implementing session management seems to be a complex task and there is few documentation about how to do that that for both Winforms an

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread vitalya
Ok, it sounds reasonable. But where validation that requires database query should be placed?. Should it go before business operation, that changes entity state? Pre-validation also would cause bugs, especially in case of complex business rules. On Aug 14, 3:58 pm, Stefan Steinegger wrote: > I w

[nhusers] criteria problem

2009-08-14 Thread Wayne Douglas
hi i've ran into a problem with the following code: IList>> criteria = new List>>(); var sn = incommingUser.ScreenName; criteria.Add(user => user.Name == username); var users = Repository.FindAll(criteria); and in the repository: public virtual IList FindAll(IList>> criteria) {

[nhusers] Re: splitting big tables and entity-name feature

2009-08-14 Thread Stefan Steinegger
Why not simply: IList result = session .CreateQuery("select m.Text from Message where m.Read = false and ...") .List(); and session.Update("Message set m.Read = false where ..."); You could also have a list of ids to know which messages need to be set to read. On 14 Aug., 14:39, "empe...@

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Oskar Berggren
2009/8/14 Stefan Steinegger : > > The index of a list is no property. It is just a column to allow NH to > read it in the same order back as it has been stored. > > Not every column is a property. Foreign keys aren't, list indexes are > also no properties. > > With a list of composite-elements you

[nhusers] Re: NullReference Exception in NH 2.1

2009-08-14 Thread Fabio Maulo
session.Delete does not work with named parameters (as the exception is saying)You should use positional parameter. session.Delete("from Foo foo where foo.ModuleId = ?", m.ModuleId, NHibernate.NHibernateUtil.Int32); 2009/8/14 nicco80 > > I posted a testcase to the nhcontrib group. > > http://g

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
The index of a list is no property. It is just a column to allow NH to read it in the same order back as it has been stored. Not every column is a property. Foreign keys aren't, list indexes are also no properties. With a list of composite-elements your Property would only look like this: publi

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
I wouldn't evict anything. Just my opinion. There is no persistence ignorance if you can tell the persistence layer to undo some changes in memory. If you implement as if there is no persistency, you don't expect to be able to undo a few changes you made in memory. There aren't "two layers" of ch

[nhusers] Re: NHibernate 2.1 HQL parser (AST/ANTLR)

2009-08-14 Thread Fabio Maulo
have a look to the dialect you are using and let me know if the LEFT function is there or not.Thanks. 2009/8/13 nerode > > Other than the fact tha I can find no documentation on this (any links > appreciated), I've found a change from the previous parser: a > statement that is designed to be ex

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Jeffrey Zhao
For the last question, the reason I use "Set" is that "List" in NH mapping has an "index". I tried to use the Property.SortOrder as the index but met a lot of problems. So I try to use a "sorted set" (as the doc mentioned) as a workaround. Thanks for your reply, I'll have a try later. I used L

[nhusers] splitting big tables and entity-name feature

2009-08-14 Thread empe...@gmail.com
In our domain model, we have a Message entity. Message entity is basic class with a simple string property and a status bool property if the message is "read" or not . The thing is we are expecting millions of messages and we would like to archive "read" messages. So I thought I could make use

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread vitalya
Hi everyone, Recently i've also faced similar problem. First i've posted a http://groups.google.com/group/castle-project-users/ browse_thread/thread/f2fc359da7228fca?hl=en"> question to castleproject-users group, but than after deeper investigation it turned out to be the NHibernate behavior. I'm

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
You should create new post to ask a new question. There is not actually a NH way, but a "transactional way" is to either commit the changes or rollback the whole thing. This is usually done by exception handling. Just an example in pseudo code: try { cat = Load(id); cat.Name = "some name";

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
You mapped the ProductID in the Property: ... <<== evil This probably resets the product id with the property value, which is not initialized. Consider to have a full reference to product (don't forget to make the set inverse="true") or just leave it away. You are working with an

[nhusers] Re: ProjectionCriteria as Having Clause

2009-08-14 Thread imm102
Thanks for replying. I had seen this patch and that is what prompted me to try the way I did. However, I am using a detached criteria to build my search query and that's the issue. Looking at the source, ProjectionCriteria is only present on CriteriaImpl. It is not on ICriteria or DetachedCriteria

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Jeffrey Zhao
Thanks, I tried. As the post said, I changed the mapping sittings like: And now NH just execute an DELETE sql as I want. But, I cannot correctly insert the data now: var product = new Product { Name = "Product" }; product.Properties.Add(new Property { Name = "P0", SortOrder = 0 }); pro

[nhusers] NHibernate 2.1 HQL parser (AST/ANTLR)

2009-08-14 Thread nerode
Other than the fact tha I can find no documentation on this (any links appreciated), I've found a change from the previous parser: a statement that is designed to be executed against MSSqlServer (2000 or 2005 dialect) used to accept the function LEFT(value, count). This now throws a NoViableAltE

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread 孤独侠客
你先加载一下这个Product,再删除试一下 From: je...@live.com To: nhusers@googlegroups.com Subject: [nhusers] How can I JUST delete an entity using NHibernate Date: Fri, 14 Aug 2009 17:12:49 +0800 Hello, I'm a new for NH and I met the problem of "how can I delete an entity". For example, I've got two entit

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread mipi
My first message here, so hello :) I am very new to NHibernate, but I like it already. > The "normal" solution for unexpected updates is: if the business logic > does not want to have something changed, it should not change it. I have a question what is the "NHibernate way" of doing this simple

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
Try Product product = session.Load(1); session.Delete(product); This should actually only create a proxy for the Product 8assuming you are using lazy loading). Then you can remove it. then you can use on-delete in the mapping to let the database clean up referenced records: http://vanryswyckjan

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
I just hoped that this obvious coding error speaks for itself. I think I understand what you mean. The test would express what I expect the method to do, regardless if this is correct or not. On 14 Aug., 11:16, Sidar Ok wrote: > Sorry, I meant what the "solution" was :) > > When you find the i

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Sidar Ok
Sorry, I meant what the "solution" was :) When you find the issue, it is nice to submit a patch, but what is nicer is to explain what the patch is supposed to do. This will help to the commiter who is reviewing your page on determining what your aim was and validating your patch, therefore it will

[nhusers] Re: NullReference Exception in NH 2.1

2009-08-14 Thread nicco80
I posted a testcase to the nhcontrib group. http://groups.google.com/group/nhcdevs/browse_thread/thread/3c0c1bd77d27f2fd Things fail when calling session.Delete("from Foo foo where foo.ModuleId = :Id", m.ModuleId, NHibernate.NHibernateUtil.Int32); with stacktrace (InnerException!) at NHibernate.P

[nhusers] How can I JUST delete an entity using NHibernate

2009-08-14 Thread Jeffrey Zhao
Hello, I'm a new for NH and I met the problem of "how can I delete an entity". For example, I've got two entity with an one-to-many association. Here's the sql to build the table (omit the association): CREATE TABLE [dbo].[Property]( [PropertyID] [int] IDENTITY(1,1) NOT NULL, [ProductID]

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
I explain the problem we encountered in the issue. The patch is intended to fix it :-) I don't know how to write a sensible test for this. Of course I can create two NativeSQLQuerySpecification instances with the same sql string and different instances of querySpaces, and show that Equals returns

[nhusers] Re: Entity "version" update happening after Commit - not Flush?

2009-08-14 Thread Stefan Steinegger
I wouldn't build dtos after the commit, because you can't use lazy loading then. Flush should actually synchronize all the changes. So I'm also wondering ... On 13 Aug., 22:42, Luke Bakken wrote: > Hello everyone, > > Just wanted to check that this is expected behavior in NHibernate. I > have s

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Sidar Ok
Would you mind a sentence of explanation on what the problem was and what this patch is intended to achieve ? (As I don't see any tests there) On Fri, Aug 14, 2009 at 9:54 AM, Stefan Steinegger < stefan.steineg...@bluewin.ch> wrote: > > We found the problem, I posted a patch: > > http://nhjira.ko

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
We found the problem, I posted a patch: http://nhjira.koah.net/browse/NH-1931 On 7 Aug., 10:15, Stefan Steinegger wrote: > Currently we are doing long running tests on our system. After a > couple or hours, the system suddenly hangs on a call to the NH > session. I don't know if this is a NH pr

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
I'm still not sure if you aren't using NH for a case it has never been designed for. Just to make it clear: every call to NH is not persistence ignorance. Only calls to the entities are (changing the data). IMO, it is a very bad idea to change the order how objects get persisted. In your case, i

[nhusers] Re: ProjectionCriteria as Having Clause

2009-08-14 Thread cws
Hello! Maybe you found this on your own by now but anyway Look on this http://nhjira.koah.net/browse/NH-1280 and in the Nhibernate.Test project on the same corresponding test On Aug 10, 7:56 pm, imm102 wrote: > Hi, > > I just upgraded to 2.1.0 and ProjectionCriteria is now no where to be > se