[nhusers] Cascading problem(s)

2009-09-11 Thread F.B. ten Kate
I'm a new NHibernate user so these questions might seem trivial but stay with me. Basically i want to be able to cascade my saves but also my deletes, now the problem i'm running into is that NHibernate wants to set the FK to NULL and after that delete the record. This update beeing pointless,

[nhusers] Re: Cascading problem(s)

2009-09-11 Thread Roger Kratz
Your first question... Read about bidirectional refs in the manual http://nhforge.org/doc/nh/en/index.html#example-parentchild-bidir Your second question I don't quite understand... -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of F.B.

[nhusers] Re: Cascading problem(s)

2009-09-11 Thread F.B. ten Kate
Well Basically, i made a ContactPerson , added this to the collection, saved the parent and it got added to the database (basically made presistant) then i get rid of the session (meaning the ContactPerson becomes detached). I then get the Entity from the database, and i try to remove the

[nhusers] Re: Cascading problem(s)

2009-09-11 Thread Roger Kratz
Yes, you should to impl Equals (and GetHashcode), at least if you're using detached instances. Here's a quite common way to do it http://nhforge.org/blogs/nhibernate/archive/2008/09/06/identity-field-equality-and-hash-code.aspx -Original Message- From: nhusers@googlegroups.com

[nhusers] Polymorphic components

2009-09-11 Thread Morten Maxild
Hi, In my domain model I have an ‘owner’ object that references another polymorphic object. I would like to setup my mapping such that the ‘aggregated’ polymorphic object is a component of the ‘owner’ (In DDD lingo I would like the polymorphic object to be a Value Object). But I think I

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread Fabio Maulo
2009/9/11 Paladin_za dirk...@gmail.com Make sense? No, without a proposal about what mean intelligent enough. NH is not an esoteric entity, it is only C# code. -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread Markus Zywitza
If you had a transient object model with a bidirectional parent-child-relationship, could you reparent your child by only setting child.Parent = newParent? Probably not. You had to ensure within the setter, that the old and new parent's references get updated, too. If you do this, you can simply

[nhusers] Re: WPF BackgroundWorker and NHibernate

2009-09-11 Thread Chris W
Yeah, I probably went a little overboard with the BackgroundWorker. You were right Chris, I was in a bit of a time crunch so I just removed most of the threading code for this release. I think you might be right about the Session being closed with a BackgroundWorker thread. I have not had

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread reflection
If I've read anything about cascading, people ALWAYS stated that if you use cascading you should also make the connection in your domain modell bi-directional. And if you do make your Domain Modell bi- directional this problem shouldn't occur. So if you do: parent.Add(child) You should also do:

[nhusers] Versioning with a timestamp updates the column with local time instead of UTC

2009-09-11 Thread Ramon Smits
I have configured a mapping that uses versioning: version name=Revision column=Revision type=Timestamp column name=Revision not-null=false/ /version When this entity is modified and saved the Revision property and column get a new value which is the current local time. Is it

[nhusers] Re: NHibernate performance issues

2009-09-11 Thread Goku Da Master
I just upgraded to NH 2.1.0-GA. No change in performance. In fact, it may have slowed it down a bit. Still looking for help here. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group. To post to this

[nhusers] Re: NHibernate performance issues

2009-09-11 Thread Tuna Toksoz
Can you show your sample project? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Fri, Sep 11, 2009 at 11:39 AM, Goku Da Master swingnc...@gmail.comwrote: I just upgraded to NH 2.1.0-GA. No

[nhusers] Re: WPF BackgroundWorker and NHibernate

2009-09-11 Thread José F . Romaniello
I need to sort some stuff in my head, and then will write a post about threading, as parte of the Chinook Media Manager sample (wpf + nh).What Fabio said is absolutely valid. The problem we are trying to solve is to build a more responsive UI, so the problem should die within the UI

[nhusers] Re: Returning a DictionaryTKey,TValue from an HQL Query

2009-09-11 Thread William Chang
Using the power of NHibernate Linq: /// summaryGet category names./summary /// remarksFor HTML form select element./remarks public static IListKeyValuePairGuid, String GetCategoryNames() { return ( from x in Models.List.Queryable where x.listIsDeleted

[nhusers] one-to-one mapping senario with single table

2009-09-11 Thread rhartzog
I'm unclear on the suggested mapping options if I have a single table and want to have a circular reference to itself. For example, an educational class has a pre-requisite class and the pre-requisite will never have a collection of dependant classes below it, only one class follows in order.

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread William Chang
For your information, these questions are outside of NHibernate, more like general database architecture questions. However... For educational classes dealing with pre-requisite class, you will probably need a one-to-many relation to an association table (which has two foreign key: the class id

[nhusers] Transaction across multiple sessions

2009-09-11 Thread e36M3
Hi all, I am trying to figure out what is the best design to hold transactions across multiple DAOs, in essence multiple sessions. Lets assume I have the following code inside a business class: -Business Object--- public void InsertAuthor(Author

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread Ryan Hartzog
Thank you William. I understand how it would be modeled in the database, what I don't understand is how to map it properly. Let me see if I can state the problem better. table employee ( EmployeeId int, FirstName nvarchar, LastName nvarchar, ManagerId int ) The ManagerId is a

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread Paladin_za
This is exactly what the domain model is doing. The unit tests I attached to the JIRA issue demonstrates this. Hence why the issue is raised in the first place. On Sep 11, 4:40 pm, reflection florian.fand...@googlemail.com wrote: If I've read anything about cascading, people ALWAYS stated

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread William Chang
Use the first one, your code snippet: public class Employee { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public Employee Manager { get; set; } } Employee emp = new Employee(...); Employee managerEmp = new Employee(...);

[nhusers] Dynamic Lazy and Cascade

2009-09-11 Thread Rui Guimaraes
I am trying to make a refresh of my entire tree of objects. If I do this by refreshing the master object it works only if I have Lazy = false and Cascade = all in my n to n connections. But every other time I want this to be off. Can I dynamically change the mapping settings of lazy and

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread Fabio Maulo
The JIRA ticket was closed http://fabiomaulo.blogspot.com/2009/09/nhibernate-tree-re-parenting.html 2009/9/11 Paladin_za dirk...@gmail.com This is exactly what the domain model is doing. The unit tests I attached to the JIRA issue demonstrates this. Hence why the issue is raised in the

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread Ryan Hartzog
In the Employee.hbm.xls file is this a one-to-one? property with type=Employee? That is my question. Thank you On Sep 11, 2:26 pm, William Chang diehardb...@gmail.com wrote: Use the first one, your code snippet: public class Employee {    public int Id { get; set; }    public string

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread William Chang
one-to-many/many-to-one Sincerely, William Chang On Sep 11, 3:39 pm, Ryan Hartzog rhart...@gmail.com wrote: In the Employee.hbm.xls file is this a one-to-one?  property with type=Employee?  That is my question. Thank you On Sep 11, 2:26 pm, William Chang diehardb...@gmail.com wrote:

[nhusers] Re: one-to-one mapping senario with single table

2009-09-11 Thread Ryan Hartzog
Thank you for your help William. Regards On Sep 11, 3:09 pm, William Chang diehardb...@gmail.com wrote: one-to-many/many-to-one Sincerely, William Chang On Sep 11, 3:39 pm, Ryan Hartzog rhart...@gmail.com wrote: In the Employee.hbm.xls file is this a one-to-one?  property with

[nhusers] Re: Versioning with a timestamp updates the column with local time instead of UTC

2009-09-11 Thread Fabio Maulo
Yes. 2009/9/11 Ramon Smits ramon.sm...@gmail.com I have configured a mapping that uses versioning: version name=Revision column=Revision type=Timestamp column name=Revision not-null=false/ /version When this entity is modified and saved the Revision property and column get

[nhusers] Re: Dynamic Lazy and Cascade

2009-09-11 Thread Fabio Maulo
2009/9/11 Rui Guimaraes rui.guimar...@gmail.com Is there a way to dynamical change this? No. -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group. To post to this group, send email to

[nhusers] Re: Transaction across multiple sessions

2009-09-11 Thread Fabio Maulo
2009/9/11 e36M3 litv...@gmail.com If I was using ADO.NET I would simply use TransactionScope(), however here it seems I almost have to move my ISession into the business object, which I think is bad design. Sure it is bad.The next question to yourself is: why the DAO should be aware on how

[nhusers] SetFetchMode Cartesian result?

2009-09-11 Thread Jason Dentler
I need to display data from an entire object graph which is lazy loaded by default (which works well for the rest of the app). I *could* do a GetByID for the root and allow lazy loading to get everything else, but I'd rather get it all inside my explicit transaction in one database round-trip. To

[nhusers] Re: Polymorphic components

2009-09-11 Thread Fabio Maulo
NHibernate does support polymorphic object.How manage it in the mapping is matter of another question. 2009/9/11 Morten Maxild mmax...@gmail.com Hi, In my domain model I have an ‘owner’ object that references another polymorphic object. I would like to setup my mapping such that the

[nhusers] Re: SetFetchMode Cartesian result?

2009-09-11 Thread Fabio Maulo
DistinctRootEntityResultTransformer btw upload a really complex object graph in just only one round trip is impossible when you are talking with an RDBMS. 2009/9/11 Jason Dentler jasondent...@gmail.com I need to display data from an entire object graph which is lazy loaded by default (which

[nhusers] Re: Dynamic component inside of a component

2009-09-11 Thread Fabio Maulo
2009/9/10 Kevin Dente kevinde...@gmail.com I'm trying to define a class that contains a component, and inside the component a dynamic component is defined. Is this a supported mapping scenario? I haven't been able to get it work, and get a very strange error. I don't know if it is

[nhusers] Re: SetFetchMode Cartesian result?

2009-09-11 Thread Jason Dentler
Thanks Fabio. I knew it would be something simple I hadn't discovered yet. I wouldn't say I'm loading up a really complex object graph, just a big one. Everything is one layer deep. I have a lot of child collections, so I end up with a long SQL select statement with a dozen or so joins, which is

[nhusers] Re: SetFetchMode Cartesian result?

2009-09-11 Thread Fabio Maulo
btw take care because... well try to write it in HQL and have a look to the exception ;)(I saw you are using bag) 2009/9/11 Jason Dentler jasondent...@gmail.com Thanks Fabio. I knew it would be something simple I hadn't discovered yet. I wouldn't say I'm loading up a really complex object

[nhusers] Re: SetFetchMode Cartesian result?

2009-09-11 Thread Jason Dentler
Hmmm OK. I'll wait on the blog post and give it a try on Monday. On Fri, Sep 11, 2009 at 5:04 PM, Fabio Maulo fabioma...@gmail.com wrote: btw take care because... well try to write it in HQL and have a look to the exception ;)(I saw you are using bag) 2009/9/11 Jason Dentler

[nhusers] Re: Why it might happen, that a SQLite database file gets locked?

2009-09-11 Thread Nelson Cabral
To make it clear : SchemaUpdate works with SQLite. The SQLite file lock problem is due to multithreaded access to an SQLite db (file). On Jul 17, 7:09 pm, J M unspr...@gmail.com wrote: Sorry, ignore that. Wrong thread. On Jul 17, 6:40 pm, J M unspr...@gmail.com wrote: SchemaUpdate is not

[nhusers] NHibernate.Linq - problem using functions in select

2009-09-11 Thread Brett Carswell
Hi All, I've added the code below to SelectionTests.cs in NHibernate.Linq.Tests. I would expect this to work but instead get the exception below. I would expect this to work. Is there an issue with the Linq provider or am I misusing it. I'm sure I have done a similar thing in the past with Linq

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread j_vanrhyn
I have exactly the same problem. In our system we do not persist our data on a record per record basis. We translate data from the domain to view models, make several changes to these view models which includes re-parenting changes. Changes to the view model is applied back to the domain and

[nhusers] Quering sets of values

2009-09-11 Thread ulu
Hi, I'm trying to fetch a list of values, rather than entities. Specifically, I've got a Page entity with a set of tags, atag being a string, and I'm trying to do something similar to SELECT Count(Value) FROM PageTags GROUP BY Value My mapping is: set name=Tags table=PageTags

[nhusers] Re: Using NHibernate 2.1 with VB.NET

2009-09-11 Thread ulu
I guess you'd have a problem if you want to use or subclass a non- compliant class from this assembly. For example, if you have a protected someProperty variable and a public SomeProperty property, using it from a subclass would be problematic. Otherwise, you should be safe. I know, I should

[nhusers] Download is broken

2009-09-11 Thread gauche
Hi, I must be doing something wrong. The latest 2.1.0 binary downloasd from http://sourceforge.net/projects/nhibernate/files/NHibernate/ are broken. I've tried on a Windows and Linux box. Neither can unzip the files as they're corrupt. Can anyone confirm? Thanks

[nhusers] Intercepting Updates

2009-09-11 Thread SteveG
I have a complex scenario here that I could use some help with. First, it's an 'append-only model' that uses a hilo for new id's. The primary keys are 'Id' and 'BegEffDate' (datetime). The goal is to still utilize the nhibernate unit of work. What needs to happen though is that if Update is

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread j_vanrhyn
That is exactly what we do in our domain to reassign a part object. So, lets say that we reassign one child and remove a second like below parent.Remove(child1) child.Parent = newParent newParent.Add(child1) parent.Remove(child2) child2.Parent = null Now, with NH's mapping set to

[nhusers] Build error on Win7 dev machine - ERROR: NHibernate requires .Net 3.5

2009-09-11 Thread mattortiz
I'm using (and have before) the tools and build recommendations that Ayende describes in hist post Running on the trunk: Building Rhino Commons (below). http://ayende.com/Blog/archive/2007/08/06/Running-on-the-trunk-Building-Rhino-Commons.aspx Summary: 1) D:\OSScd nhibernate 2)

[nhusers] Re: Dynamic component inside of a component

2009-09-11 Thread Kevin Dente
Is this more readable? Problematic components is Fields, which has a nested dynamic-component FieldValues in it hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 default- access=property auto-import=true default-cascade=none default- lazy=true class xmlns=urn:nhibernate-mapping-2.2

[nhusers] Re: Dynamic component inside of a component

2009-09-11 Thread Fabio Maulo
A little bit but no so much...(too much unnecessary tags)I would like to know why a component should have only one dynamic-component instead use dynamic-component directly. 2009/9/11 Kevin Dente kevinde...@gmail.com Is this more readable? Problematic components is Fields, which has a nested

[nhusers] Re: Download is broken

2009-09-11 Thread Fabio Maulo
use a real zip soft as 7z 2009/9/11 gauche kent.booga...@googlemail.com Hi, I must be doing something wrong. The latest 2.1.0 binary downloasd from http://sourceforge.net/projects/nhibernate/files/NHibernate/ are broken. I've tried on a Windows and Linux box. Neither can unzip the files

[nhusers] Re: Quering sets of values

2009-09-11 Thread Fabio Maulo
And you have idea about this?SELECT Count(Value) FROM PageTags GROUP BY Value 2009/9/11 ulu uluhonol...@yandex.ru Hi, I'm trying to fetch a list of values, rather than entities. Specifically, I've got a Page entity with a set of tags, atag being a string, and I'm trying to do something

[nhusers] Re: NHibernate.Linq - problem using functions in select

2009-09-11 Thread Fabio Maulo
session.LinqUser().ToList().Select(u = Convert(u)); 2009/9/11 Brett Carswell brett.carsw...@gmail.com Hi All, I've added the code below to SelectionTests.cs in NHibernate.Linq.Tests. I would expect this to work but instead get the exception below. I would expect this to work. Is there an

[nhusers] Re: Why does NHibernate force me to do it's work for it

2009-09-11 Thread Fabio Maulo
2009/9/11 j_vanrhyn johan.vanr...@gmail.com I see this as a bug and think that paladin_za rightly logged it as a bug. We should talk about DDD and how easy manage it but if you try to visit the blog-post you will find the solution and the way to solve your problem. -- Fabio Maulo

[nhusers] Re: Dynamic component inside of a component

2009-09-11 Thread Kevin Dente
I'm not totally sure I understand your question. The general shape of the objects are: Object1 Component1 Component2 DynamicComponent(IDictionary) The object model looks roughly like: class ArchetypeInstance { public ModifiedInstance Modified { get; set; } public