[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread Kris-I
solution for the sorting ? 2009/6/29 Markus Zywitza > Map the same collection to two different properties and include the > where-clause to the second mapping; setting update and insert to false is > also strongly recommended. > --~--~-~--~~~---~--~~ You received

[nhusers] Re: Collection loader with more than one parameter

2009-06-29 Thread dyahav
Is it possible to pass more than one parameter to the loader? On 29 יוני, 19:25, Fabio Maulo wrote: > 2009/6/29 frag0610 > > > > > The main reason is performance. > > The parent object has a collection of more than 10 000 child objects > > and it is very long to load. > > You shouldn't mapping

[nhusers] Re: Nhibernate over WCF

2009-06-29 Thread V
On Jun 28, 9:15 pm, V wrote: > > Yes but, as I said in the second answer, the final behaviour (of what NH > > will do) depend on the type of the collection (an will have a > > different behaviour of a ). > Hello again friends. I created a small demo and it works fine except one issue. If I get

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Fabio Maulo
Only as advise (it is old but still work): http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.html 2009/6/29 Brian Sullivan > > Thanks, everyone, for the responses! It was, as a couple of people > have suggested, a customized getter-setter in the Contact class. The > Sta

[nhusers] Subset Relation

2009-06-29 Thread Moss
Our database schema has a Payer table with a unique id key named PayerId. A very few of these payers are special, so we use a primary key relationship table called DefaultPayer to denote which of those payers are designated as default payers. DefaultPayer also has PayerId as its primary key, but

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Brian Sullivan
Thanks, everyone, for the responses! It was, as a couple of people have suggested, a customized getter-setter in the Contact class. The State property looked like the following: public virtual string State { get { return m_strState != null

[nhusers] jet driver cast exception

2009-06-29 Thread Berryl Hesh
Hello: I'm getting a problem with a legacy access db I need to support, and which used to work with Jet Driver. The error is: System.InvalidCastException : Unable to cast object of type 'NHibernate.JetDriver.JetDbConnection' to type 'System.Data.Common.DbConnection' I downloaded the latest cut

[nhusers] Re: Readable Criteria ?

2009-06-29 Thread James Gregory
That's great news, I look forward to seeing how he can transform the criteria. On Mon, Jun 29, 2009 at 11:54 PM, Fabio Maulo wrote: > 2009/6/29 James Gregory > >> Looks excellent! > > > Yes!! excellent work by Richard Brown. > Richard have accepted to be part of NH's team, few days after make p

[nhusers] Re: Readable Criteria ?

2009-06-29 Thread Fabio Maulo
2009/6/29 James Gregory > Looks excellent! Yes!! excellent work by Richard Brown. Richard have accepted to be part of NH's team, few days after make public his project, and rethink nhibernate lambda before include it in core. -- Fabio Maulo --~--~-~--~~~---~--~---

[nhusers] Re: Readable Criteria ?

2009-06-29 Thread James Gregory
Looks excellent! On Mon, Jun 29, 2009 at 11:43 PM, Fabio Maulo wrote: > I'm proud to announce the big steps NH3.0.0 is doing > http://fabiomaulo.blogspot.com/2009/06/nhibernate3-criteria. > > -- > Fabio Maulo > > > > --~--~-~--~~~---~--~~ You received this messag

[nhusers] Readable Criteria ?

2009-06-29 Thread Fabio Maulo
I'm proud to announce the big steps NH3.0.0 is doing http://fabiomaulo.blogspot.com/2009/06/nhibernate3-criteria. -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Fabio Maulo
2009/6/29 Jason Meckley > > the updates happen at flush because this is how NH works. up until you > flush the session NH is simply tracking changes. it's not actually > making changes (that's not entirely true depending on the PK > generator). Partially true; for some reason do anything inside

[nhusers] Re: Changing ISession.SessionFactory

2009-06-29 Thread Fabio Maulo
2009/6/29 Jason Meckley > > why not manage multiple session factories at once. each factory can be > used within a given Domain Context. Castle has a facility to manage > this with ISessionManager. If nothing else you can review the code and > build your own. uNhAddIns has ISessionFactoryProvid

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Kenneth Siewers Møller
Whether or not NHibernate is making changes is irellevant. If an UPDATE statement is issued, the database is being modified, which is a sign of aither a) wrong mapping or b) modification during load. From my experience, the most typical reason for NH to issue UPDATEs to the database is because of m

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Kenneth Siewers Møller
I don't know whether it's the same issue, but I usually experienced this behavior when I (unintentianally) was modifying my entities when loading them from the database. NHibernate thinks they are dirty and therefore tries to update the changes when the session is flushed. At that time, I didn't fu

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Oskar Berggren
2009/6/29 Brian Sullivan : > > Oskar, > > Thanks for the reply!  Yes, it looks like calling ToList() does cause > the update to happen as well (once I call session.Flush()).  I'm not > sure if anything is actually being updated, since unfortunately SQL > Profiler doesn't provide the values for the

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Jason Meckley
if you want to see what NH is doing behind the scenes check out www.nhprof.com. cost is dirt cheap, especially for the wealth of knowledge it provides. the updates happen at flush because this is how NH works. up until you flush the session NH is simply tracking changes. it's not actually making

[nhusers] Re: Changing ISession.SessionFactory

2009-06-29 Thread Jason Meckley
why not manage multiple session factories at once. each factory can be used within a given Domain Context. Castle has a facility to manage this with ISessionManager. If nothing else you can review the code and build your own. On Jun 29, 3:02 pm, Oskar Berggren wrote: > 2009/6/29 Mind Works : > >

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Brian Sullivan
Oskar, Thanks for the reply! Yes, it looks like calling ToList() does cause the update to happen as well (once I call session.Flush()). I'm not sure if anything is actually being updated, since unfortunately SQL Profiler doesn't provide the values for the "@" params in its display. I'd have to

[nhusers] Re: SQLite Transactions not rolling back?

2009-06-29 Thread Mike Nichols
Hm...it seems like ISession should hold on to the reference since it is in its map but state won't be synched with the db. Can you try what I suggested it and insert the call to Session.Clear() or Evict before the call to .Get<>() ? On Jun 29, 8:26 am, Colin Bowern wrote: > Hi Mike, > > Thanks f

[nhusers] Re: Adding setter to ISession.SessionFactory

2009-06-29 Thread Fabio Maulo
I don't know why you need to recreate the session-factory so often, IMO there is something wrong in somewhere else or NH is not the project for your needs. 2009/6/29 Mind Works > > Thanks Fabio. > > e.g. We have 10 objects and we build a session factory. Now when 11th > object comes we destroy t

[nhusers] Re: Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Oskar Berggren
Does the UPDATE statement actually change something? One thing I can think of is a NULL in a varchar column somewhere being coerced into an empty string, which NHibernate then sees as a dirty object. Or the other way around. Does this happen even if you comment out the two rows involving dlContact

[nhusers] Re: Changing ISession.SessionFactory

2009-06-29 Thread Oskar Berggren
2009/6/29 Mind Works : > > Hi, > > Background: > We have 1600 objects to be loaded in the session factory, thus > impacting the memory footprint of the application. In the endeavor to > reduce the memory footprint we are loading the objects dynamically > where we are destroying the existing sessio

[nhusers] Re: Composite-Element simple question.

2009-06-29 Thread Fernando Zago
Let me show you how do i think. how do u map this data schema ? Table: Items Column: ItemID (int) (identity) Column: ItemName (string) Column: ItemUrl (string) Table: Tags Column: TagID (int) (identity) Column: ItemID (int) (foreign key from Items) Column: PrincipalTag (string) Table: TagWords C

[nhusers] Re: Adding setter to ISession.SessionFactory

2009-06-29 Thread Mind Works
Thanks Fabio. e.g. We have 10 objects and we build a session factory. Now when 11th object comes we destroy the existing session factory and create a new one with 11 objects. Now this session factory is being assigned to ISession.SessionFactory (by changing code to add new setter property). So Se

[nhusers] Re: Adding setter to ISession.SessionFactory

2009-06-29 Thread Fabio Maulo
2009/6/29 Mind Works > 1. Is the above change to NH a valid change. No. The session-factory, as its name mean, is the factory of session that mean a session can know who have created it and you can't change the creator (as everybody can't change his natural mother). > > 2. What is the procedur

[nhusers] Why is NHibernate doing an Update when I Databind?

2009-06-29 Thread Brian Sullivan
I'm starting to play with NHibernate to make a case for its use in our company's projects. I've created a branch of one of our solutions and have started to convert some of the data access to using NHibernate as a proof-of-concept. However, while looking at SQL Profiler, I discovered that NHiberna

[nhusers] Changing ISession.SessionFactory

2009-06-29 Thread Mind Works
Hi, Background: We have 1600 objects to be loaded in the session factory, thus impacting the memory footprint of the application. In the endeavor to reduce the memory footprint we are loading the objects dynamically where we are destroying the existing session factory and recreating one every tim

[nhusers] Adding setter to ISession.SessionFactory

2009-06-29 Thread Mind Works
Hi, Background: We have 1600 objects to be loaded in the session factory, thus impacting the memory footprint of the application. In the endeavor to reduce the memory footprint we are loading the objects dynamically where we are destroying the existing session factory and recreating one every tim

[nhusers] Multiple levels of inheritance

2009-06-29 Thread Chuck Boyde
I am busy modeling a financial transaction system. In this system I have types of financial transactions like payments (representing purchases of an item) & refunds. Simple for this example. I have modeled the domain like this so far: Payment abstract class, inheriting from FinancialTransaction

[nhusers] NHibernate & NServiceBus

2009-06-29 Thread Michael Baldry
Hi there, I have just got NServiceBus working correctly and it handles incoming messages, now I've come across a problem. If I try and access my NHibernate Repository within the message handler thread I get the following exception straight away: The partner transaction manager has disabled its su

[nhusers] Re: Collection loader with more than one parameter

2009-06-29 Thread Fabio Maulo
2009/6/29 frag0610 > > The main reason is performance. > The parent object has a collection of more than 10 000 child objects > and it is very long to load. You shouldn't mapping something if it does not work with lazy=false. After that, do what you want and fight with it. -- Fabio Maulo --

[nhusers] Re: Collection loader with more than one parameter

2009-06-29 Thread frag0610
The main reason is performance. The parent object has a collection of more than 10 000 child objects and it is very long to load. Most of the time, I just need to load a small part of the collection but sometimes, I must load the all collection. On 29 juin, 03:30, dummerchen wrote: > If this is

[nhusers] Re: Problem mapping joined-subclass and retreiving collection

2009-06-29 Thread Dan
Oskar, Thank-you so much! I have re-factored so that my Project only has 1 collection (of ProjectMedia), and each list (Videos and Images) returns either a list of ProjectVideo or ProjectImage objects. It is still not perfect, as it is not as "readable" as it was having two separate collections

[nhusers] Inheritance Types and Proxy

2009-06-29 Thread Scott
I'm having trouble with writing an ICriteria query that will get me a fully initialized (non-proxy) object for inheritance types for this scenario... Table Structure == [Bulletin] - | [Publication]> < [PublicationPublication] >-

[nhusers] Re: SQLite Transactions not rolling back?

2009-06-29 Thread Colin Bowern
Hi Mike, Thanks for the reply! To be clear: If I abort a transaction I should also clear the session? Thanks, Colin On Jun 29, 3:48 am, Mike Nichols wrote: > You need to clear your session. Session.Clear() > > On Jun 28, 12:57 pm, Colin Bowern wrote: > > > > > While building out a few spikes

[nhusers] Re: Mapping multiple level inheritance hierarchy with table per class hierarchy method

2009-06-29 Thread Michael Hedgpeth
I cross-asked the question on stackoverflow ( http://stackoverflow.com/questions/1045573/how-to-manage-a-multiple-level-class-hierarchy-in-nhibernate-with-table-per-class) and they correctly pointed out that I needed to nest my subclass elements. That worked for me, so I no longer have an issue. H

[nhusers] Re: Mapping multiple level inheritance hierarchy with table per class hierarchy method

2009-06-29 Thread Michael Hedgpeth
In hopes that I can get a solution to my problem, I did some more research with the NHibernate codebase. The problem seems to be in SingleTableEntityPersister.cs, line 543, DiscriminatorFilterFragment (string alias) method which has this code: string[] subclasses

[nhusers] Re: Problem with Castle ByteCode provider

2009-06-29 Thread JamesSpibey
Sorry, ignore this. I hadn't got my nhibernate references setup correctly. Apologies for spamming the list On Jun 29, 2:12 pm, JamesSpibey wrote: > Hi, > > I have been trying to run the latest trunk version of nhibernate but I > can't seem to get the Castle proxy working correctly. The error I g

[nhusers] Re: Mapping multiple tables

2009-06-29 Thread Oskar Berggren
This is especially true if in you legacy database you (can) have several person rows referring to the same row in the address table. /Oskar 2009/6/29 Oskar Berggren : > The clause is for when you want to "merge" two or more tables > into the same class. In your case, it seems natural to have a

[nhusers] Re: Mapping multiple tables

2009-06-29 Thread Oskar Berggren
The clause is for when you want to "merge" two or more tables into the same class. In your case, it seems natural to have a Person class that references an Address class. These are mapped to separate tables, and the relation is mapped using or (even if in practice it is one-to-one). This appear

[nhusers] Re: Problem mapping joined-subclass and retreiving collection

2009-06-29 Thread Oskar Berggren
Your usecase seem a bit unusual. Shouldn't the point of polymorphism would be to avoid multiple implementations of AddImage/Video, multiple collections, etc? Anyway, for your second attempt, look into adding where-clauses to your bag-elements (http://nhforge.org/doc/nh/en/index.html#collections-ma

[nhusers] Problem with Castle ByteCode provider

2009-06-29 Thread JamesSpibey
Hi, I have been trying to run the latest trunk version of nhibernate but I can't seem to get the Castle proxy working correctly. The error I get is:- Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Poss

[nhusers] Re: Mapping multiple tables

2009-06-29 Thread ike bailey
The example I gave is one that I found here: http://ayende.com/Blog/archive/2007/04/24/Multi-Table-Entities-in-NHibernate.aspxIt's a good example, but the tables that we have in our database are more complex than thi

[nhusers] Re: Problem mapping joined-subclass and retreiving collection

2009-06-29 Thread Dan
Ok, since no-one is willing to help, I've done more Googling and discovered that you should map the polymorphic association in the collection when using the table-per-subclass strategy, and NHibernate will take care of the rest. So, now I have this: ProjectMedia - base class, abstract ProjectVide

[nhusers] load-collection with parameters

2009-06-29 Thread dyahav
Hi, Is there a way to pass parameters to an sql query for collection loader? SELECT . I tried to use filter but it does not work with loader. Do you have any suggestion how to pass parameter to the sql query? Thanks dyahav --~--~-~--~-

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread Markus Zywitza
Map the same collection to two different properties and include the where-clause to the second mapping; setting update and insert to false is also strongly recommended. -Markus 2009/6/29 Kris-I > Exact > > 2009/6/29 dummerchen > >> >> I don't quite get your point ? In one case you want to loa

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread dummerchen
Than have a look at the filter mechnism of hibernate. You can enable/ disable the filter for each session. In your case you would enable the filter for the first method and disable it for the second. --~--~-~--~~~---~--~~ You received this message because you are su

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread Kris-I
Exact 2009/6/29 dummerchen > > I don't quite get your point ? In one case you want to load just a > subset of the collection and in another you need the complete > collection ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

[nhusers] collection is not associated with any session

2009-06-29 Thread rak
Hello, I have the following Mapping file.. This seems to cause collection is not associated with any session error. If I change tp I don't get the error, but the Sql generate uses Id rather than SubMarket as the par

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread dummerchen
I don't quite get your point ? In one case you want to load just a subset of the collection and in another you need the complete collection ? -- Wolfgang --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" grou

[nhusers] Re: Filter/Sort on loaded collection

2009-06-29 Thread Kris-I
To be clear, at this time, I have this : public ActionResult DayOff(Guid? employeeid) { EmployeeDayOffModel employeeDayOffModel = new EmployeeDayOffModel(); employeeDayOffModel.Employee = _repositoryEmployee.Get(employeeid); return View("Employee

[nhusers] Re: SQLite Transactions not rolling back?

2009-06-29 Thread Mike Nichols
You need to clear your session. Session.Clear() On Jun 28, 12:57 pm, Colin Bowern wrote: > While building out a few spikes to play around with NHibernate and I > have hit a wall with transactions under SQLite.  My configuration > looks like: > > FluentNHibernate.Cfg.Db.SQLiteConfiguration >    

[nhusers] Re: Collection loader with more than one parameter

2009-06-29 Thread dummerchen
If this is the only reason why you want to use a custom sql for collection loading, try hibernate filter instead: http://nhforge.org/doc/nh/en/index.html#filters They provide a very powerful interface for dynamic collection loading. -- Wolfgang --~--~-~--~~~---~--~--

[nhusers] Theta for Non-Mapped association ala ICriteria

2009-06-29 Thread Mike Nichols
Is the recent NH still not supporting theta joins? I need to join two tables that don't have a mapped association and it appears theta is still my only option. Is there a hack in ICriteria to do this? I'd use a subquery but unfortunately my problem is compounded by needing to set projections for a