[nhusers] Re: hibernate.cfg.xml - Multiple databases

2009-03-09 Thread nobodybutca
My I have a sample if you don't mind? For 3 session factories. On Mar 6, 7:53 pm, Fabio Maulo wrote: > catalog = each class mapping may have its catalog > 3 ms access = Access is not a RDBMS, 3 xyz.cfg.xml with 3 session factories. > > 2009/3/6 nobodybutca > > > > > > > Anyone? > > > On Mar 5,

[nhusers] Getting a StaleObjectStateException when using Merge

2009-03-09 Thread christianacca
The irony here is that I'm using Merge to try and recover from a StaleObjectStateException! I'm using of r4098 from the NHibernate trunk. Here's the test case: [Test] public void Should_be_able_to_merge_stale_object() { var obj = new Location { Address = new Address("1", "1", "1", "1") };

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
Try to create a failing NUnit test and create a new issue (improvement) in our JIRA.Thanks. 2009/3/9 Germán Schuager > Fabio, I've made up the Cat class only to show my point: session.Merge is > accessing properties of instances in invalid state when it is not needed. > > I do have the real use-

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
Fabio, I've made up the Cat class only to show my point: session.Merge is accessing properties of instances in invalid state when it is not needed. I do have the real use-case and I assure you that it makes a lot more sense than the cat ;) only that it is very complex to present it here... The so

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
Ah... German... try to recreate the situation out-side the code of the application; I'm sure you will find the solution or at least you can send us a real use-case with a real class and a real mapping. 2009/3/9 Fabio Maulo > so.. in a property getter you are accessing to a Relationship loaded us

[nhusers] NHibernate resultset -> entities slow?

2009-03-09 Thread Jimmy Shimizu
Hi, I'm using NHibernate with part of the Active Record implementation for the actual configuration. I'm experiencing some performance-issues when NHibernate populates my entities, and I'm wondering if these numbers are to be expected? I have e query, generating approx 700 rows (larger than it u

[nhusers] Re: NHibernate resultset -> entities slow?

2009-03-09 Thread Fabio Maulo
To know if it is normal try to do the same using a DataReader and instancing your entities. 2009/3/9 Jimmy Shimizu > > Hi, I'm using NHibernate with part of the Active Record implementation > for the actual configuration. > > I'm experiencing some performance-issues when NHibernate populates my

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
so.. in a property getter you are accessing to a Relationship loaded using lazy-loading, inside the same class... and all to have a unnormalized property.interesting and discouraged approach. Inside the getter you should check if "state" is a proxy and in that case you should initialize it (the dy

[nhusers] Re: Association across multiple databases

2009-03-09 Thread Sathish
Are these databases reside in one server or in multiple servers? If it's one server following is the solution http://mikehadlow.blogspot.com/2008/10/mapping-entities-to-multiple-databases.html - Sathish On Thu, Mar 5, 2009 at 12:48 PM, graphicsxp wrote: > > Hi, > > I've got two business entit

[nhusers] NEWBIE question

2009-03-09 Thread c24chan
Hi all: This is a newbie question, so please bear with me. I have the following tables (simpify version). CITY: city (varchar2) (PK) province (varchar2) (PK) CITY_TL: city (varchar2) (PK) province (varchar2) (PK) lang (char (2)) (PK) LOCATION: location (varchar2) (PK) some other column. As y

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
My actual model is somewhat more complex than this: public interface INum { int Num { get; } } public class Cat : Entity, INum { private State state; protected Cat() { } public Cat(State state) { this.state = state; } public virtual State State { get { return state;

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
Mapping please. 2009/3/9 Germán Schuager > inline > > On Mon, Mar 9, 2009 at 5:11 PM, Fabio Maulo wrote: > >> The fact is that the Merge need to read the state from DB but with its >> result in the persistent class (not from DataReader). > > > I think that I understand. That is the case of merg

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
inline On Mon, Mar 9, 2009 at 5:11 PM, Fabio Maulo wrote: > The fact is that the Merge need to read the state from DB but with its > result in the persistent class (not from DataReader). I think that I understand. That is the case of merging a detached entity, but when merging a new transient

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
The fact is that the Merge need to read the state from DB but with its result in the persistent class (not from DataReader).BTW I don't understand how you can work with that entity... NH use the parameterless ctor not only for Merge but even when you use session.Get(id). In case of Get/Load who are

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
Thanks Fabio, I will take a look at what a tuplizer is :), but I don't see why NH needs to access the properties of a newly created object just to overwrite them with the transient instance properties' values. I'm browsing the NH source to trying to find out but it is complex beast... It seems th

[nhusers] Re: Association across multiple databases

2009-03-09 Thread Ryan Rinaldi
NHibernate only talks to one database. -Ryan Rinaldi blog: http://ryanrinaldi.com On Mon, Mar 9, 2009 at 10:20 AM, graphicsxp wrote: > > Linked servers ? I'm not sure what this is. Is there not a "simple" > way through configuring the mapping files ? > > On 5 mar, 18:05, Tuna Toksoz wrote: > >

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
Ah.. sorry.. in Merge sure it access to the getter... sorryIf you need a certain ctor you should implement your own tuplizer (I don't know where you will find the State instance but it is another matter). 2009/3/9 Germán Schuager > I've tried it. It does access the getters when merging an entit

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
I've tried it. It does access the getters when merging an entity in the method CopyValues of DefaultMergeEventListener.cs https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate/Event/Default/DefaultMergeEventListener.cs On Mon, Mar 9, 2009 at 3:14 PM, Fabio Maul

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
NH don't access to the getter during object creation. Try it. 2009/3/9 Germán Schuager > Hi Fabio, > > Num is a persistent property, and I have several entities that implement > INum; in this case Cat is delegating its actual implementation to its > private field "state". > > I don't think that

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Germán Schuager
Hi Fabio, Num is a persistent property, and I have several entities that implement INum; in this case Cat is delegating its actual implementation to its private field "state". I don't think that a nosetter access for Num would solve the problem because the exception would be generated anyway (whe

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread graphicsxp
Thanks for the explanation, greatly appreciated. That makes sense. I'm still learning... On 9 mar, 17:23, Jay Chapman wrote: > The answer to that question is that you don't.  Think of NHibernate as a > synchronization tool, not a database persistence tool.  It's trying to make > it so that the

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread Jay Chapman
The answer to that question is that you don't. Think of NHibernate as a synchronization tool, not a database persistence tool. It's trying to make it so that the database is a form of "extended memory". You want both the Person assigned to the Car and the Car added to the person's collection whe

[nhusers] Re: Session.Merge issue

2009-03-09 Thread Fabio Maulo
If Num is a persistent property you should use- a field only to make NH happy (you don't need to use it) - Num access="nosetter.camelcase"... if I well remember we have another accessor in NH2.1 access="read-only" 2009/3/9 Germán Schuager > Hi, > > I want to do a merge of a transient object whic

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread graphicsxp
Thanks Jay, So basically you are saying that what I do is correct, but your solution is a shortcut as you are assigning the Person entity to the Car entity within the Add() method. Fair enough, but my initial question was, how can I do it without having to specify the Person entity, i.e have the

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread graphicsxp
ok i got it you mean adding the Car entity to my collection of cars in Person. :) But that's exactly what I do already : myPerson.cars.add(new Car(1, myPerson)) myPerson.cars.add(new Car(2, myPerson)) sorry I should have included this code in my first post. Yet I still get the problem. O

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread Jay Chapman
cars.Add(car) car.Person = this; On Mon, Mar 9, 2009 at 12:22 PM, graphicsxp wrote: > > Hi Roger, > can you explain ? what's in AddCar ? > > On 9 mar, 15:56, Roger Kratz wrote: > > myPerson.AddCar(myCar) > > > > -Original Message- > > From: nhusers@googlegroups.com [mailto:nhus...@googl

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread graphicsxp
Hi Roger, can you explain ? what's in AddCar ? On 9 mar, 15:56, Roger Kratz wrote: > myPerson.AddCar(myCar) > > -Original Message- > From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of > graphicsxp > Sent: den 9 mars 2009 16:52 > To: nhusers > Subject: [nhuser

[nhusers] Re: Association across multiple databases

2009-03-09 Thread graphicsxp
Linked servers ? I'm not sure what this is. Is there not a "simple" way through configuring the mapping files ? On 5 mar, 18:05, Tuna Toksoz wrote: > Or may not. > > Tuna > Toksözhttp://tunatoksoz.comhttp://turkiyealt.nethttp://twitter.com/tehlike > > Typos included to enhance the readers atten

[nhusers] Re: issue with bi-directional one-to-many association when saving

2009-03-09 Thread Roger Kratz
myPerson.AddCar(myCar) -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of graphicsxp Sent: den 9 mars 2009 16:52 To: nhusers Subject: [nhusers] issue with bi-directional one-to-many association when saving Hello, I have a question about bi

[nhusers] issue with bi-directional one-to-many association when saving

2009-03-09 Thread graphicsxp
Hello, I have a question about bidirectional one-to-many associations. Let's consider we have a class Person which can hold a collection of entities of type Car. My mapping file for Car would have something like : and my mapping file for Person would contain : Now that i

[nhusers] Re: Is there a way to specify the names of the indexes created by SchemaExport?

2009-03-09 Thread bzurer
the unique-key does create a unique index but, like the primary key, there seems to be no way to specify a name for it. My assumption was that the value of the unique-key attribute would also be the name of the generated index, but this results in a unique index on called U

[nhusers] Session.Merge issue

2009-03-09 Thread Germán Schuager
Hi, I want to do a merge of a transient object which some of its properties are assigned with detached objects, in order to get a persistent object with all its properties assigned with persistent instances (using cascade="merge"). Is this the correct usage scenario for merge? Here is a sample en

[nhusers] Re: Problem with m:n relation using association object

2009-03-09 Thread James Gregory
Don't know about 2, but I'm pretty sure with 1 you either live with it or make it bidirectional. On Mon, Mar 9, 2009 at 2:39 PM, Mario Hallmann < mario.hallm...@googlemail.com> wrote: > > Hi, > > from an extracted sample application i get the following sql output > which is not as i would like it

[nhusers] Problem with m:n relation using association object

2009-03-09 Thread Mario Hallmann
Hi, from an extracted sample application i get the following sql output which is not as i would like it to be: 1. session: NHibernate: INSERT INTO [MyAssociatedObject] DEFAULT VALUES; select SCOPE_IDENTITY() NHibernate: INSERT INTO [MyObject] DEFAULT VALUES; select SCOPE_IDENTITY() NHibernate:

[nhusers] Re: One-To-Many : impossible to delete

2009-03-09 Thread Kris-I
And this : Hibernate Exception: Illegal attempt to associate a collection with two open sessions >        I receive this error : >        could not delete collection: > [Com.SIT.Base.Business.Product.MyAssembly#18][SQL: SQL not available] --~--~-~--~~~---~--~~ You

[nhusers] One-To-Many : impossible to delete

2009-03-09 Thread Kris-I
Hello there, I have 2 tables "OrderDetails" and "Product" with a one-to-many relation. Since I added this relation, I just see the problem now, ... impossible to delete a product even if this product is not used in OrderDetail. The query executed is UPDATE [Product] SET[ProductId] = null WH

[nhusers] Re: Is there a way to specify the names of the indexes created by SchemaExport?

2009-03-09 Thread James Gregory
I believe you're looking for unique-key, not index. As for the primary key, I don't think you can set the name of the constraint it generates. On Mon, Mar 9, 2009 at 11:40 AM, bzurer wrote: > > Given this mapping a unique index is created in the database on the > Name column. > > > > >

[nhusers] Is there a way to specify the names of the indexes created by SchemaExport?

2009-03-09 Thread bzurer
Given this mapping a unique index is created in the database on the Name column. I would like to specify the name of the index that NHibernate generates when the unique attribute is set to true. Setting the attribute index="MyIndexName" creates an index with that name but it is not u

[nhusers] Re: ORA-01830: date format picture ends before converting entire input string.

2009-03-09 Thread Fabio Maulo
You are using something to generate the mapping.In the class or in the HQL there is something wrong. Check the type of this two properties: TimeFinished TimeMainlineDuration Ensure you are using query.SetDateTime("parameterName", value). P.S. The query you sent us is not related to the mapping you

[nhusers] Re: NHIbernate Property Formula bug?

2009-03-09 Thread Remco Ros
This issue is also related to http://nhjira.koah.net/browse/NH-1654 The specific dialects need to register their reserved keywords. 1654 fixed this for the TOP keyword in MSSql dialects. On Mar 7, 12:46 am, robcar wrote: > It seems that this is a confirmed bughttp://jira.nhibernate.org/brows

[nhusers] Re: NHIbernate Property Formula bug?

2009-03-09 Thread robcar
Thanks, it did! :-) On 7 Mar, 07:38, Tuna Toksoz wrote: > This should help > > http://nhforge.org/blogs/nhibernate/archive/2008/09/06/prepare-your-s... > > Tuna > Toksözhttp://tunatoksoz.comhttp://turkiyealt.nethttp://twitter.com/tehlike > > Typos included to enhance the readers attention! > >

[nhusers] ORA-01830: date format picture ends before converting entire input string.

2009-03-09 Thread kumpfi
Hello, i have the following problem: When i want to get objects between a special date i get the error, that nhibernate could not execute query with the ORA-01830: date format picture ends before converting entire input string. When i copy the generated SQL string into SQL developer and excecut