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,
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.
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
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
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
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
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
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
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:
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
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
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
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
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
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.
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
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
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
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
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(...);
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
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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
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
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
51 matches
Mail list logo