[nhusers] Re: Where to Apply an Aspect

2009-02-20 Thread aeden.jame...@gmail.com
Thanks for the direction! I'll look into it. Would you happen to know why the aspect I'm introducing with the line @event.Entity = Factory.GetProxy(); gets stripped? On Feb 20, 8:44 am, Fabio Maulo wrote: > To apply Aspect you should write your own IProxyFactory or better more your > own NH

[nhusers] Re: Row Version Not Being Updated as Expected

2009-02-20 Thread JoAnnP38
Done -- NH-1685 http://nhjira.koah.net/browse/NH-1685 On Feb 20, 1:49 pm, Fabio Maulo wrote: > Please create a JIRA coping this mail. Thanks. > > 2009/2/20 JoAnnP38 > > > > > > > Given the following mappings: > > > > >                                   default-cascade="save-update" > > auto-

[nhusers] Re: Subclass creation/removal with persisted parent class?

2009-02-20 Thread Germán Schuager
Use composition instead of inheritance. http://www.cs.sjsu.edu/faculty/pearce/modules/patterns/analysis/Actor.htm On Fri, Feb 20, 2009 at 3:59 PM, deuce wrote: > > I have the following simple class structure, simplified for post: > > class Person > { >public int ID; > } > > class Student :

[nhusers] Subclass creation/removal with persisted parent class?

2009-02-20 Thread deuce
I have the following simple class structure, simplified for post: class Person { public int ID; } class Student : Person { public Student(Person person){} } The problem I am facing is when I pass in the person and assign all the values to this object including the ID, it wants to update

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread Fabio Maulo
Probably the better solution is to upload that prj with our source, review it, and make it available for all users.I'll talk about this problem in our dev-list thanks. 2009/2/20 JoAnnP38 > > Do I need to explicity load hibernate.cfg.xml? For some reason, it > looks like your basic test fixture c

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread JoAnnP38
Do I need to explicity load hibernate.cfg.xml? For some reason, it looks like your basic test fixture calls configure *after* compiling the mappings. Is this incorrect code in your project? private void Configure() { cfg = new Configuration(); Assembly assembly = Assembly.Load(MappingsAss

[nhusers] Re: Row Version Not Being Updated as Expected

2009-02-20 Thread Fabio Maulo
Please create a JIRA coping this mail. Thanks. 2009/2/20 JoAnnP38 > > Given the following mappings: > >default-cascade="save-update" > auto-import="true" > assembly="NHibernate.Test" > > namespace="NHibernate.Test.NHSpecificTest.NH1234" > >

[nhusers] Re: Row Version Not Being Updated as Expected

2009-02-20 Thread JoAnnP38
Given the following mappings:

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread Fabio Maulo
Probably you are not running the configuration in your test. 2009/2/20 JoAnnP38 > > The content of Mappings.hbm.xml looks like: > > >default-cascade="save-update" > auto-import="true" > assembly="NHibernate.Test" > > namespace="NHibernate.Te

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread JoAnnP38
The content of Mappings.hbm.xml looks like:

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread JoAnnP38
Wow, this is becomming very tedious to report the error if I need to get a unit test running in the standard test project. :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, sen

[nhusers] Re: Creating a Unit Test for JIRA

2009-02-20 Thread JoAnnP38
The full exception info is: NHibernate.MappingException was caught Message="Could not compile the mapping document: NHibernate.Test.NHSpecificTest.NH1234.Mappings.hbm.xml" Source="NHibernate" StackTrace: at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) at NHibe

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Ramin
@ Greg Well, I've read a little bit about aggregate roots now and understand that my comments were pretty dumb, to say the least. Thanx for being courteous and providing sincere answers. To answer your question, I now see an aggregate as a set of objects which make up one unit and which have cons

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
@Greg, Look I don't agree with Ramin to the full extent of what he says implies, but I don't agree with you either. "Let's reword this. How about "aggregate roots are usually consistency boundaries"." That is tipical of components (Component based Architecture). The problem is that any Domain O

[nhusers] Re: Mapping a class with two mapping files

2009-02-20 Thread Fabio Maulo
partial classes 2009/2/20 Humberto Marchezi > Hi, > > Sorry, now I realize *I can´t do what I planned in .NET*. > > I was trying to find a way to break a Domain Class so that it doesn´t have > to hold a reference to all kinds of Classes. Initially I thought I could do > that with Extension Meth

[nhusers] Re: Where to Apply an Aspect

2009-02-20 Thread Fabio Maulo
To apply Aspect you should write your own IProxyFactory or better more your own NHibernate.ByteCode.XYZWith the ByteCode you have full control about anything is related to proxy generation. In NH2.1.0 (the trunk) you have two implementation : LinFu, Castle. Another partial example is here: http://f

[nhusers] Re: Where to Apply an Aspect

2009-02-20 Thread aeden.jame...@gmail.com
I do have additional optional behavior, that has varying implementations, that needs to be apart of some classes some of the time. And some of those classes I control and others I don't. Of the ones I don't I can reasonably count on the interface staying the same. On Feb 20, 3:45 am, Fabio Maulo

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Greg Young
> They simply pull you away from it into a component-persistance > oriented way of thinking, there is no way around this. Just look at > the questions in the DDD forum. Yes, and others on the forum correcting these people... I am going to step out of this conversation now but you seem to be very

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
Thanks Ramin for the info. I'm orderinf that book right now. I think this idea is feaseble withou too much work. But I need to dig deeper into the technical details of NHibernate. Nuno On Feb 20, 4:05 pm, Nuno Lopes wrote: > Then again probably not. So close and yet so far due a technical > de

[nhusers] Re: Mapping a class with two mapping files

2009-02-20 Thread Humberto Marchezi
Hi, Sorry, now I realize *I can´t do what I planned in .NET*. I was trying to find a way to break a Domain Class so that it doesn´t have to hold a reference to all kinds of Classes. Initially I thought I could do that with Extension Methods but I don´t have a way to store the association values

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
I can't send actual classes and tables, but let's try simple example: abstract class BusinessObject { } class ConcreteObject1 : BusinessObject { } class ConcreteObject2 : BusinessObject { } Additionaly thera are many ohter classes inherited from ConcreteObject1 as well as ConcretObject2. Excep

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Greg Young
> Aggregate roots do the same > thing (At least I believe they do. I will read up about them in a > while, eg. in Evans). > So it is a generally accepted and applied > standard to put framework dependency into the domain - even though it > is "hidden behind" frameworks using things like attribute

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
Then again probably not. So close and yet so far due a technical detail around the persistance mechanis :( I guess I need to implement some kind of set of objects that are to be locked later at commit time (LockMode.Read). This set will be populated by the Proxy that I've been talking about. Thi

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
Sorry but to create a mapping i must know, at least, 2 things: the class and how you want represent its persistent state.As you know, given a class graph you can represent its persistent state in various ways. 2009/2/20 Piotr Jakóbczyk > > I can't send a actual classes and tables, but try to co

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
I can't send a actual classes and tables, but try to consider simple example: abstract class BusinessObject { } class ConcreteObject1 : BusinessObject { } class ConcreteObject2 : BusinessObject { } On 20 Lut, 16:26, Fabio Maulo wrote: > Ok.Please send classes and tables, then we can talk ab

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Ramin
> I understand that we need to check if the object is Dirty before doing > a lock (otherwise data will be lost). Yes > Also this will lock the record > in the DB for reads correct? No. >From what "NHibernate in Action" mentions about lock modes (None, Read, Upgrade, UpgradeNoWait, Write - inte

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
Ok.Please send classes and tables, then we can talk about mappings. 2009/2/20 Piotr Jakóbczyk > > Yes, I know syntax of "mixing table per class hierarchy with table per > subclass". > But I require one SHALLOW (used as read-onlu) hierarchy used subclass> and several distinct hierarchy used "mix

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
Is there a way to mark an object Dirty even though no changes where done to it? The reason I ask is becouse I think this would force a version check at commit time on that object. That is all I need to make this work :) Nuno On Feb 20, 2:51 pm, Nuno Lopes wrote: > @Peter, > > This is the kin

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
Yes, I know syntax of "mixing table per class hierarchy with table per subclass". But I require one SHALLOW (used as read-onlu) hierarchy used and several distinct hierarchy used "mixing table per class hierarchy with table per subclass" with base db tables from first one hierarchy. On 20 Lut, 1

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
The strategy "mixing table per class hierarchy with table per subclass" is a special and specific feature of Hibernate and NHibernate.The implementation is Reference here: http://nhforge.org/doc/nh/en/index.html#inheritance-tablepersubclass-discriminator 2009

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
@Peter, This is the kind of info I was looking for :) Reading NHibernate docs its says: "You may also call Lock() instead of Update() and use LockMode.Read (performing a version check, bypassing all caches) if you are sure that the object has not been modified. " "LockMode.Read is acquired aut

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
Thanks for quick response. Let my explain in details what kind of mappings I need. We have composed hierarchy of objects with common base abstract class - BusinessObject. Until now we have whole hierarchy mapped by . But becouse of performance reasons and specificity of realized queries we want t

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
Your mapping is wrong...You should define the ClassB inside the node and no out-side as an independent class. one example from our tests (for simplicity) 2009/2/20 Piotr Jakóbczyk > > I know what union-subclass is and I read references about all > inheritance strategy imple

[nhusers] Re: Mapping a class with two mapping files

2009-02-20 Thread David Mukaiwa
I imagine it shouldn't be an issue to persist the class in diff DBs with separate configs and session factories if that's what you mean. On Fri, Feb 20, 2009 at 1:50 PM, Fabio Maulo wrote: > Do you want "persist methods"(behavior) ?Please try to explain better what > you are looking for. > > 200

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
You CAN'T use mapping more than one class to the same table. If you want use only one table you must use or a trick like this http://fabiomaulo.blogspot.com/2008/10/power-of-orm.html 2009/2/20 Piotr Jakóbczyk > > I know what union-subclass is and I read references about all > inheritance strat

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Peter Morris
>> Doesn't NHibernate do some kind lock to do a version check (locking update on that object for the time of the DB transaction, SELECT FOR UPDATE) ? << Version numbers are for checking conflicts on the *same* object, they can't be 100% reliable for checking conflicts on objects you are not upd

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
I know what union-subclass is and I read references about all inheritance strategy implemented by NH. In my example I used (look at SubclassA entity mapping). But why, in my example, the changing of the order of mapping definitions provide different behevoiur of NH. The first order raises excepti

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
I see Peter. Doesn't NHibernate do some kind lock to do a version check (locking update on that object for the time of the DB transaction, SELECT FOR UPDATE) ? If it doesn't, how can NHibernate assure me that is not overwriting data using Optimistic Locking even for a single Object!!! (Reliable

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
A good white paper to read before continue using NH is here http://nhusers.googlegroups.com/web/WhitePaper_Mapping_Objects_To_Relational_Databases.pdf 2009/2/20 Fabio Maulo > union-subclass is an advanced way provided by NH to implement the mapping > pattern : table-per-concrete-class > What you

[nhusers] Re: + mapping multiple classes into one table

2009-02-20 Thread Fabio Maulo
union-subclass is an advanced way provided by NH to implement the mapping pattern : table-per-concrete-class What you are looking for is the implementation of the pattern : table-per-class-hierarchy The tag for that is ; reference available here http://nhforge.org/doc/nh/en/index.html#mapping-decla

[nhusers] NH Spatial compatible with NH2.1

2009-02-20 Thread stachu
Hi! I found NH Spatial very interesting and promesing. I wanted to give it a try but I noticed that it's build against NH2.0.1. However at work we use NH2.1 and it tried to build NHSP with it but it failed. My question is if you are planning to upgrade it in near future? Best regards Mike --~--~-

[nhusers] NHibernate.Burrow 1.0.2 GA is released!

2009-02-20 Thread Kailuo . Wang
NHibernate.Burrow is a light weight middleware developed to support .Net applications using NHibernate (maybe also referred as NH in this article) as ORM framework by providing advanced and smart session/transaction management and other facilitates. Documentation and examples are available

[nhusers] + mapping multiple classes into one table

2009-02-20 Thread Piotr Jakóbczyk
Hi, I need to map multiple clesses into one database table.The common table (TABLE1) is shared by class ClassB and SubclassA (subclass of ClassA) mapped by . Mapping file looks like in the following example:

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Peter Morris
>> I'm assuming that NHibernate does the version check at commit/flsh time. In other words NHibernate commits all data and version ckecks in a single database transaction. If that is not the case, this doesn't work! << Even if it *is* the case, without some kind of update-lock it still wont work

[nhusers] Re: Mapping a class with two mapping files

2009-02-20 Thread Fabio Maulo
Do you want "persist methods"(behavior) ?Please try to explain better what you are looking for. 2009/2/20 Humberto Marchezi > Hi community, > > Let´s I have a domain class Person in the assembly PersonDomain.dll and I > have its extension methods AddDocument, RemoveDocument, GetDocuments, etc..

[nhusers] Re: Where to Apply an Aspect

2009-02-20 Thread Fabio Maulo
Do you need to inject something in your entities? 2009/2/20 aeden.jame...@gmail.com > > I would like to use Spring.Net to apply an introduction to certain > objects that are loaded by NHibernate 2.0.1. I've attempted doing it > in the PostLoad event. The essence of what I'm doing in the listene

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Nuno Lopes
@Peter, I'm assuming that NHibernate does the version check at commit/flsh time. In other words NHibernate commits all data and version ckecks in a single database transaction. If that is not the case, this doesn't work! Im assuming that NHibernate makes Version Checks and a INSERTs or UPDATEs i

[nhusers] Mapping a class with two mapping files

2009-02-20 Thread Humberto Marchezi
Hi community, Let´s I have a domain class Person in the assembly PersonDomain.dll and I have its extension methods AddDocument, RemoveDocument, GetDocuments, etc.. a separated assembly DocumentDomain.dll . I have a Mapping file Person.hbm.xml for Person in PersonDomain.dll working fine however I

[nhusers] Re: Objects State Validation && Business Rules in non Trivial Domain Models

2009-02-20 Thread Ramin
--> "... and how do we model that logic without allowing a dependency in our domain on the framework?" We don't. Adding an attribute like [ConflictBusinessRule] puts a dependency in our domain on the framework. Aggregate roots do the same thing (At least I believe they do. I will read up about th

[nhusers] Where to Apply an Aspect

2009-02-20 Thread aeden.jame...@gmail.com
I would like to use Spring.Net to apply an introduction to certain objects that are loaded by NHibernate 2.0.1. I've attempted doing it in the PostLoad event. The essence of what I'm doing in the listener is ProxyFactory Factory = new ProxyFactory (@event.Entity);

[nhusers] Re: No auto flush before Criteria execution

2009-02-20 Thread James Lanng
Thanks for the reply. I neglected to mentioned that I'm using MultiCriteria. As far as I can tell, the flushing logic is missing from this and from MultiQuery. Does that sound right? On Feb 19, 4:32 pm, Ayende Rahien wrote: > auto flush only happens when you are querying for something that yo