[nhusers] Re: problems building criteria

2009-08-18 Thread dummerchen
I would start with something like this: session.CreateCriteria(customerType, "c") .CreateAlias("c.Invoices", "i" ) .CreateAlias("c.Orders", "o" ) .Add(Expression.Or(Expression.Gt("i.Amount", 20.0), Expression.Gt ("o.Total", 10))); -- Wolfgang --~--~-~--~~

[nhusers] hql query

2009-08-18 Thread Yusuf Nar
hi, [Title] table has below columns. Id, Lang, Url, Text, CreateDate i want to create a hql query, such as; select Id, Lang from Title; When i use hql it selects all columns in Title table. So it downgrades performance. How can i achieve this? Thanks for your help. --~--~-~--~~-

[nhusers] Re: Custom Id Generator and "error performing isolated work"

2009-08-18 Thread Chris Nicola
Bah I hate it when I solve the problem 5 minutes after I ask. So it appears that SQLite in memory databases can only support one session and after that they are done. Interesting. Sorry to have been a bother ;-). On Tue, Aug 18, 2009 at 4:48 PM, Chris Nicola wrote: > I should have noted I hav

[nhusers] problems building criteria

2009-08-18 Thread darren
I'm trying to or two conditions together that are not rooted to the same place and am not having much luck. Here's a simple schema: Order : shipdate,total Invoice : invoicedate,amount Customer : name,orders,invoices I'm trying to construct a query to select customers having either invoices with

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Brian
I was able to get this to work by modifying DeepCopy to return a copy of the collection. I'm not sure how/where DeepCopy is used so I can't say whether this is a bad idea. Here's the updated (working) IUserType. [Serializable] public class EnumerationListType : IUserType where T : Enumeration

[nhusers] Re: Custom Id Generator and "error performing isolated work"

2009-08-18 Thread Chris Nicola
I should have noted I have tried using normal HiLo instead and I get the same error. Clearly I am not setting up my tests or configuration correctly. Thanks, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nh

[nhusers] Re: Nhibernate pretty sql command ?

2009-08-18 Thread Jim Tanner
Thanks Tuna and Fabio it was very helpfull. On 18 août, 17:56, Fabio Maulo wrote: > truethe "hibernate" was removed. > > 2009/8/18 Jim Tanner > > > > > > > Thanks a lot Adding in hibernate.cfg.xml > > true > > did the job in a blink. > > Helps a lot in debugging. > > > On 18 août, 12:25, Tuna

[nhusers] Custom Id Generator and "error performing isolated work"

2009-08-18 Thread Chris Nicola
Ok this is a bit strange. I am still having some issues with this custom ID generator. So far everything has been working well up until now, but today I decided to fix the test fixture base class I was using to start nHibernate. It was using SessionSource from Fluent instead of SessionFactory()

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Tuna Toksoz
err iteration won't help here. please paste all usertype definition here. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Aug 18, 2009 at 11:41 PM, Brian wrote: > > Well, that's what we have

[nhusers] Re: Unable to set parameter for HQL DML insert

2009-08-18 Thread Martin Nyborg
I need to know if this is a bug. I expect that the SetInt32 function replaces some text with a number. In my example replaces the text projectId with 10 On Aug 18, 1:45 am, Martin Nyborg wrote: > I am trying to set the parameter projectId > > Session.CreateQuery(@"insert into Milestone (Project

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Brian
Thanks! This looks like it might fit the bill actually: http://code.google.com/p/unhaddins/source/browse/trunk/uNhAddIns/uNhAddIns/UserTypes/PropertiesNamesType.cs On Aug 18, 3:42 pm, Fabio Maulo wrote: > have an idea without have a look to the code is something difficult...perhaps > this will

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Brian
Well, that's what we have currently: return object.Equals(x, y); The problem is that both x and y are always the same. It's as though we are never getting the original version of the object. On Aug 18, 3:37 pm, Tuna Toksoz wrote: > you override the equals and check if each item is equal. > > T

[nhusers] Re: Is that an insect?

2009-08-18 Thread Nelson
I'd prefer using the NH trunk itself, in case I want to submit a fix patch with bug reports. I changed the config file NHibernate.Driver.SqlServerCeDriver NHibernate.Dialect.MsSqlCeDialect Data Source=C: \Documents and Settings\Cowboy\Mes documents

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Fabio Maulo
have an idea without have a look to the code is something difficult...perhaps this will be useful to you: http://fabiomaulo.blogspot.com/2009/06/localized-property-with-nhibernate.html It is a IUserType represented by

[nhusers] Re: IUserType and Collections

2009-08-18 Thread Tuna Toksoz
you override the equals and check if each item is equal. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Aug 18, 2009 at 11:31 PM, Brian wrote: > > Hello, > > I have a database schema that re

[nhusers] IUserType and Collections

2009-08-18 Thread Brian
Hello, I have a database schema that requires storing a series of delimited strings. The domain model represents these as an IList. (Where Enumeration is a Tarantino Enumeration). We have a custom IUserType to persist the collection as a string. Inserts works fine. However, changes do not persis

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Jason Meckley
my experience is that letting NH infer the schema on legacy (existing) databases will lead to bugs/errors in production. If however I am building the project from the scratch (and starting with the domain) then I let NH design my DB schema. If the database already exists and NH will map to the db

[nhusers] Re: Is that an insect?

2009-08-18 Thread Tuna Toksoz
IF you are notexperienced with SVN there is another way. http://nhforge.org/blogs/nhibernate/archive/2008/10/04/the-best-way-to-solve-nhibernate-bugs-submit-good-unit-test.aspx

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Fabio Maulo
2009/8/18 Cesar Sanz > Ok, just to specify the length, > > but what about the type, it is better to let nhibernate to infer the type? > Yes!! is better to maintain the mapping more clear as possible and magnifier only real custom/special attributes. For example: why write not-null="false", in e

[nhusers] Re: Is that an insect?

2009-08-18 Thread Tuna Toksoz
You can use detached db or normal db in express. Choose one and set an empty database.Don't forget to play with connection string. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Aug 18, 2009 a

[nhusers] Re: Is that an insect?

2009-08-18 Thread Fabio Maulo
Could not open connection to: Server=(local);initial catalog=nhibernate;Integrated Security=SSPI This is the connectionstring: Server=(local);initial catalog=nhibernate;Integrated Security=SSPI 2009/8/18 Nelson > > Hum installed VS2008 Express (w/ SQL Server Compact), NUnit, NAnt, > TortoiseSVN.

[nhusers] Re: Is that an insect?

2009-08-18 Thread Nelson
Hum installed VS2008 Express (w/ SQL Server Compact), NUnit, NAnt, TortoiseSVN. After compiling with NAnt, I started NUnit and ran NHibernate.Test. Most test fails because of this error : NHibernate.Test.Ado.BatcherFixture (TestFixtureSetUp): NHibernate.HibernateException : Could not open connect

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Cesar Sanz
Ok, just to specify the length, but what about the type, it is better to let nhibernate to infer the type? - Original Message - From: Fabio Maulo To: nhusers@googlegroups.com Sent: Tuesday, August 18, 2009 12:23 PM Subject: [nhusers] Re: Let nhibernate guess your type? Tha

[nhusers] Re: Handling Unique constraints - exception or validation or ....???

2009-08-18 Thread Bartłomiej Szafko
Great points - thanks for your input On 18 Sie, 20:23, Maik wrote: > Hi Stefan, > > this is a good behaviour. I keep it the same way. > All things which can be done within the db should be done in it. > > No one prevents us from implementing it somewhere else. > > So far, > Maik > > On 18 Aug.,

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Fabio Maulo
but... if you are working in a new prj is better if you trust in the default type NH is using 2009/8/18 Symon Rottem > NHibernate determines the type of the database column into which it should > store data based on the type of the property against which it is mapped. > > If you don't specify th

[nhusers] Re: Handling Unique constraints - exception or validation or ....???

2009-08-18 Thread Maik
Hi Stefan, this is a good behaviour. I keep it the same way. All things which can be done within the db should be done in it. No one prevents us from implementing it somewhere else. So far, Maik On 18 Aug., 13:19, Stefan Steinegger wrote: > I'm also still searching for a nice solution for thi

[nhusers] Re: Session management in desktop application

2009-08-18 Thread Fabio Maulo
CpBT : Conversation Per Business Transaction You can find some re-post in NH-Forge of WPF with NH as persistent-layer. 2009/8/17 Vicente > > Hi, > > I'm starting to use nHibernate and after some basics tests and > mappings, I've been reading a little about session management and how > to write m

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Fabio Maulo
That is because the convention for string is len=255 2009/8/18 Fabio Maulo > > > 2009/8/18 spiralni > > >> Hello, >> >> I have a column in my database that is of type varchar(50) >> >> my question is: >> >> or ? >> >> which one is the best, and why? >> >> >> > > > -- > Fabio Maulo > -- F

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Fabio Maulo
2009/8/18 spiralni > > Hello, > > I have a column in my database that is of type varchar(50) > > my question is: > > or ? > > which one is the best, and why? > > > -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[nhusers] Re: Let nhibernate guess your type?

2009-08-18 Thread Symon Rottem
NHibernate determines the type of the database column into which it should store data based on the type of the property against which it is mapped. If you don't specify the type then NHibernate will assume that as string will be stored in an NVARCHAR column (although it will still work with VARCHA

[nhusers] Let nhibernate guess your type?

2009-08-18 Thread spiralni
Hello, I have a column in my database that is of type varchar(50) my question is: or ? which one is the best, and why? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send

[nhusers] Re: Database column field type is 'bit' - what is NHibernate type equivalent?

2009-08-18 Thread Fabio Maulo
The rule of thumbs of mapping is:don't try to be clear, specify only what NH does not know by convention. The convention is simple: - The column has the same name of the property. - The type is defined by the default for the System.Type of the property - String len is 255 - precision/scale: 18,5

[nhusers] Re: Nhibernate pretty sql command ?

2009-08-18 Thread Fabio Maulo
truethe "hibernate" was removed. 2009/8/18 Jim Tanner > > Thanks a lot Adding in hibernate.cfg.xml > true > did the job in a blink. > Helps a lot in debugging. > > On 18 août, 12:25, Tuna Toksoz wrote: > > format_sql property in config file. > > > > Tuna Toksöz > > Eternal sunshine of the open

[nhusers] Re: Database column field type is 'bit' - what is NHibernate type equivalent?

2009-08-18 Thread Fabio Maulo
"Boolean" or even better That's all. 2009/8/18 Billy Stack > > Hi all, > > I have a database column that is of type "bit" > > What is the NHibernate type equivalent? > > i.e. > > > > Cheers, > Billy > > > > -- Fabio Maulo --~--~-~--~~~---~--~~ You received t

[nhusers] Database column field type is 'bit' - what is NHibernate type equivalent?

2009-08-18 Thread Billy Stack
Hi all, I have a database column that is of type "bit" What is the NHibernate type equivalent? i.e. Cheers, Billy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send ema

[nhusers] Re: Nhibernate pretty sql command ?

2009-08-18 Thread Jim Tanner
Thanks a lot Adding in hibernate.cfg.xml true did the job in a blink. Helps a lot in debugging. On 18 août, 12:25, Tuna Toksoz wrote: > format_sql property in config file. > > Tuna Toksöz > Eternal sunshine of the open source mind. > > http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhtt

[nhusers] Re: NHibernate 2.1 Dependency Injection and/or Proxy Issue

2009-08-18 Thread Nick Clarke
Had a little play with a collection and managed to get this working without any problems. After going back to the many-to-one definition and the log I noticed that it was trying to do a single select to get the company. I changed the fetch to join and it worked fine! I then tried the following m

[nhusers] Re: Mapping XDocument/XmlDocument to MS Sql Xml-DataType

2009-08-18 Thread Mikael Henriksson
Yeah patch was added. The amount of work needed was ridiculous so it should be added in really.. On Sun, Aug 2, 2009 at 11:48 PM, Fabio Maulo wrote: > well... everybody is interested and the right place for a patch regarding > an NH issue is the JIRA ticket. > > 2009/8/2 Mikael Henriksson > > F

[nhusers] Re: Adding new Interface IPostEvent to NHibernate.Event

2009-08-18 Thread Tuna Toksoz
Please send this to devel , Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Aug 18, 2009 at 2:59 PM, Maik wrote: > > Hi there, > > I'm currently developing an AuditLogging for NHibernate 2.

[nhusers] Adding new Interface IPostEvent to NHibernate.Event

2009-08-18 Thread Maik
Hi there, I'm currently developing an AuditLogging for NHibernate 2.0.1 and during that I realized, that it would be a nice feature, if you could add another Interface which would save much time =) public interface IPostEvent { object Entity {get;} object Id {get;} IEntityPersister Persister {g

[nhusers] Re: NHibernate 2.1 Dependency Injection and/or Proxy Issue

2009-08-18 Thread Nick Clarke
I tried this and I now get: An association from the table Bookings refers to an unmapped class: Rental.Core.ModelInterfaces.ICompany --App.Data.User.Cs public interface IUser { Int64 Id { get; set; } ICompany Company { get; set; } String Name { get; set; } } public class User : IUser

[nhusers] Re: Handling Unique constraints - exception or validation or ....???

2009-08-18 Thread Stefan Steinegger
I'm also still searching for a nice solution for this. At the moment, I stick with this: The business logic is generally responsible for data consistency. It needs to check uniqueness as well as others. Consider that there are many validations that can not be covered by the database anyway, becau

[nhusers] Re: delete child item without loading the parent.

2009-08-18 Thread Stefan Steinegger
You could probably make the friends table an own entity. Then you can load it (not loading the users because of lazy loading) and delete it. The lists in the users would be inverse, so you don't have to update them (if the are NOT in the session, unless your session will be out of synch). By the

[nhusers] Re: NHibernate 2.1 Dependency Injection and/or Proxy Issue

2009-08-18 Thread Roger Kratz
Use interfaces in your model Eg IUser ICompany Company {get; set;} -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of Nick Clarke Sent: den 18 augusti 2009 12:13 To: nhusers Subject: [nhusers] NHibernate 2.1 Dependency Injection and/or Pro

[nhusers] Re: Missing AddAttribute method in FluentNHibernate 1.0 RC?

2009-08-18 Thread Jeffrey Zhao
Sorry, I mean the SetAttribute(s) method. Jeffrey Zhao Blog: http://www.cnblogs.com/JeffreyZhao Twitter: http://twitter.com/jeffz_cn -- From: "Jeffrey Zhao" Sent: Tuesday, August 18, 2009 6:28 PM To: Subject: [nhusers] Missing AddAttribute metho

[nhusers] Re: Missing AddAttribute method in FluentNHibernate 1.0 RC?

2009-08-18 Thread Tuna Toksoz
Please ask your question in , group. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike 2009/8/18 Jeffrey Zhao > > Hello, > > I've upgraded to FluentNHibernate 1.0 RC and find the AddAttribute method >

[nhusers] Re: Nhibernate pretty sql command ?

2009-08-18 Thread Tuna Toksoz
format_sql property in config file. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 17, 2009 at 8:16 PM, Jim Tanner wrote: > > I think i have read somewhere a few month ago that nhibernat

[nhusers] Missing AddAttribute method in FluentNHibernate 1.0 RC?

2009-08-18 Thread Jeffrey Zhao
Hello, I've upgraded to FluentNHibernate 1.0 RC and find the AddAttribute method is missing in OneToManyPart (and some other types). I used AddAttribute for the "sort" attribute of one-to-may mapping. How can I do with RC? Jeffrey Zhao Blog: http://www.cnblogs.com/JeffreyZhao Twitter: http://

[nhusers] delete child item without loading the parent.

2009-08-18 Thread kasvis...@gmail.com
I have a need to create a bidirectional many-to-many mapping. I have implemented it as 2 many-to-many mapping. I have a User table. I need to keep track of the User friends. So for example if I add User2 as the friend of User1. Then when i load User2, I should see User1 as Friend of User2. I a

[nhusers] Session management in desktop application

2009-08-18 Thread Vicente
Hi, I'm starting to use nHibernate and after some basics tests and mappings, I've been reading a little about session management and how to write my own persistence layer. The application I'm working in is a pretty complex WPF app, that is used to visualize a lot of data (and then edit it). It h

[nhusers] Handling Unique constraints - exception or validation or ....???

2009-08-18 Thread Bartłomiej Szafko
Hi, I've been using NH with FNH for quite some time and I am a really happy user :) Lately I began to wonder how should unique constraints exceptions be handled: let's say I've got a Name property which is unique, now when trying to save a duplicate value NH throws SqlException wrapped in Generi

[nhusers] NHibernate 2.1 Dependency Injection and/or Proxy Issue

2009-08-18 Thread Nick Clarke
I'm trying to use the new dependency injection for nhibernate managed objects but I seem to be running into problems, even when the entity does not need anything injected. I followed this example: http://nhforge.org/blogs/nhibernate/archive/2008/12/12/entities-behavior-injection.aspx and setup n

[nhusers] Nhibernate pretty sql command ?

2009-08-18 Thread Jim Tanner
I think i have read somewhere a few month ago that nhibernate will output 'pretty sql', eg better formatted sql. Has it been implemented ? Is there a config switch or a command somewhere ? --~--~-~--~~~---~--~~ You received this message because you are subscribed t

[nhusers] Re: nhibernate & MVC

2009-08-18 Thread Nick Clarke
I found this approach yesterday: http://zvolkov.com/blog/post/2009/08/06/Easiest-way-to-hook-up-ASPNET-MVC-with-NHibernate.aspx But changed the logic a bit and put the ISession into my repository class. Now in my controllers I just do: myRepo.Get("KeyName") --~--~-~--~~~