[nhusers] nhibernate mapping iset and bag

2009-03-26 Thread Yuvan
I have a simple many to many association like below 1.User(UserId) 2.UserProjects(UserId,ProjectId,RowId) 3.Projects(ProjectId) When I do a mapping with many to many with a bag collection of Users in Projects the nhibernate query generated for adding a user to project turns out to be Dim p as

[nhusers] Intellisense nhibernate.dll

2009-03-26 Thread Joost
Hi, I'm fairly new to NHibernate and I've just got my first sample application running. I'm using Visual c++ (.net framework 3.5 sp1), visual studio express 2008. VS studio does not perform code completion on code statements involving the NHibernate classes/namespaces, e.g. intellisense does not

[nhusers] Re: Problems querying with NHibernate + Lucene.Net

2009-03-26 Thread Rémi
Looking into this further, I found "Luke", the Lucene Index Toolbox, which has allowed me to look at my index and try some ad-hoc queries. I've found a few things which I'm wondering about... I rebuilt the index tonight, and I've noticed that my project version was updated from 0.2.3372.26162 to

[nhusers] NHibernate Search with Integer Fields

2009-03-26 Thread Colin Ramsay
Hi, I have the following failing test: using (var sess = Container.Resolve().OpenSession()) { using (IFullTextSession fullTextSession = NHibernate.Search.Search.CreateFullTextSession(sess)) { Page page = new Page { Title = "mypage", OwnerId = 1 };

[nhusers] Re: Problems querying with NHibernate + Lucene.Net

2009-03-26 Thread Rémi
I can a bit, but not much as I'm not able to catch it - it only comes up when I'm navigating my code's objects and variables in the locals window. When I expand the qry object after the call to CreateFullTextQuery, if I expand qry in the Locals window, the ReturnTypes propery shows as value: 'qry

[nhusers] Re: Persisting to flat files rather than a database

2009-03-26 Thread JozefSevcik
or maybe sqlite/whatever-embedded may be granted as 'flat file' too ;) On Mar 25, 1:01 pm, x97mdr wrote: > Has anyone ever used NHibernate (say with the text odbc drivers) to > persist their information to a set of flat files in addition to a > database? > > The reason I ask is that my applicat

[nhusers] Re: Problems querying with NHibernate + Lucene.Net

2009-03-26 Thread JozefSevcik
"Visual Studio raises an NHibernate.QueryException" Can you post exception details ? On Mar 26, 7:55 pm, Rémi wrote: > Can anyone help out a newbie? > > I've been working at getting NHibernate + Lucene.Net working > together.  I've got indexes built on a few fields of a single class - > correctl

[nhusers] Re: TimeSpan >24h or <0h

2009-03-26 Thread Stefan Steinegger
Hi all. I agree with Oskar, Roger and Jay. Timespan is conceptually a duration (time interval), not a time. We use it to express "age" like 1h, 24h, 7days, 1month etc. Using it as a time is a very special case that should be explicit. After all because it reduces the value range massively. You wou

[nhusers] Proxy cast problem for base object, not proxied property

2009-03-26 Thread Graham Bunce
All, I'm getting a weird problem - I'm doing the following call: ILocation loc = Session.Get(id); and NH is throwing this error: Exception Unable to cast object of type 'INHibernateProxyProxy2183142372c34751a1aceee41a501ee3' to type 'Intellident.Core.Domains.Location'. at NHibernate.Impl.Se

[nhusers] Problems querying with NHibernate + Lucene.Net

2009-03-26 Thread Rémi
Can anyone help out a newbie? I've been working at getting NHibernate + Lucene.Net working together. I've got indexes built on a few fields of a single class - correctly, as far as I can tell - but I've been unable to build a query that returns results. Here's a snippet:

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Greg Young
I wouldn't use container.Resolve ... but similar idea ... It prevents your domain objet from needing the dependency outside of the scope of the operation (construction). The need is unfortunately more of a technical one due to how the language works but by introducing the separation it can be avoi

[nhusers] LockMode.Upgrade Question

2009-03-26 Thread adressin
Hello, I am using the LockMode.Upgrade lock mode on a query to prevent concurrent access to a row. Using a simple test case with 2 Sessions I can see that Session 2 will not execute it's query until Session 1 commits it's transaction, but in our application we are seeing something strange. The

[nhusers] Re: 2 collections of the same entity

2009-03-26 Thread distansia
If you are working with a legacy database (equals "you can not modify the tables") then you should take Ken's approach. If not, and you can modify the tables, you need 2 IDs in the TblStudent, and your mappings would be (note the inverse false and the column names): ...

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Fabio Maulo
Try to study how HighLow are working in NH.You will see that you have only two better options: guid.comb : no round-trips because assigned in client side assigned : you custom ID assigned by your application; no round-trips because assigned in client side After that HighLow is the better option if

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Daniel Auger
Example scenario: - Web farm with 20 servers - ASP.NET app using SessionFactory singleton pattern It would seem then that only 20 different things would interested in the hi table, and that selects/increments would not be happening too often with the default maxlow options. That seems quite scala

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
>> Did you mean persistent or transient? I need a transient dependency to a >> service. >Not surprisingly I am using the definition of transient itself not >refering to a transient vs persistent object. In other words for 95+% >of cases the object does not need to *remember* which service to us

[nhusers] Re: NH Spatial compatible with NH2.1

2009-03-26 Thread Dario Quintana
You can ask by a ticket here: http://nhjira.koah.net/browse/NHSP On Thu, Mar 26, 2009 at 12:47 PM, Bruno wrote: > > Same question... > > On 20 fev, 08:39, stachu wrote: > > Hi! > > I found NHSpatialvery interesting and promesing. I wanted to give it > > a try but I noticed that it's build again

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Fabio Maulo
Well... it depend, if you are creating a session-factory for each persistence action, the the round-trip to read the High value is only your last concern. The roundtrip happen only one time per-session-factory per-table (inside maxlow, obviously) 2009/3/26 Daniel Auger > > Please excuse my ignor

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Tuna Toksoz
The Hi values are read once (until lo becomes larger than int16.Max(default) I don't ever think it becomes a bottleneck. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Thu, Mar 26, 2009 at 6:27 PM

[nhusers] Re: Linq2nhibernate soundex?

2009-03-26 Thread Tuna Toksoz
not implemented. However, you can use your own functions, but i don't remember how. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Thu, Mar 26, 2009 at 11:10 AM, Sebastien Lambla wrote: > > I did

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Daniel Auger
Please excuse my ignorance, but can the high table reads/increments ever become a performance bottleneck since every session factory has to do a read/increment on the same table/column? I'm guessing that maybe in theory the answer is yes, but in practicality the answer is no. On Mar 26, 8:32 am,

[nhusers] Linq2nhibernate soundex?

2009-03-26 Thread Sebastien Lambla
Hi all, I did a quick scan but couldnt find static methods to use the soundex function in linq2nhib. Have I missed it or is it just not implemented? Thanks, Seb _ 25GB of FREE Online Storage – Find out more http://clk.a

[nhusers] Subqueries DetachedCriteria and SetMaxResult

2009-03-26 Thread nightik
This is simple example, originary code is Code: var a_DetachedCriteria = DetachedCriteria.For(); a_DetachedCriteria .SetProjection(Property.ForName("ID")) .Add(x => x.Login == a_UserLogon) .Add(u => u.Password == a_UserPsw) .Add(u => u.Status == UserStatus.Actual) .SetMax

[nhusers] Re: NH Spatial compatible with NH2.1

2009-03-26 Thread Bruno
Same question... On 20 fev, 08:39, stachu wrote: > Hi! > I found NHSpatialvery 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 planni

[nhusers] Re: 2 collections of the same entity

2009-03-26 Thread Ken Egozi
hmm maybe: where Gender='laddie' / where Gender='lassie' On Thu, Mar 26, 2009 at 5:09 PM, Joao wrote: > > > Hi, I'm trying to map 2 collections of the same entity, but when I > load the data from the database, both collections have the same > entities, because they map the same key column

[nhusers] 2 collections of the same entity

2009-03-26 Thread Joao
Hi, I'm trying to map 2 collections of the same entity, but when I load the data from the database, both collections have the same entities, because they map the same key column... Here is a sample code part similar to mine, where a "School" has 2 collections of "Students", the Boys and the Girl

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Greg Young
> I have > found very very few circumstances where an entity needed a > non-transient dependency to something. > << > > Did you mean persistent or transient? I need a transient dependency to a > service. > Not surprisingly I am using the definition of transient itself not refering to a transient

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Greg Young
> I have > found very very few circumstances where an entity needed a > non-transient dependency to something. > << > > Did you mean persistent or transient? I need a transient dependency to a > service. > Not surprisingly I am using the definition of transient itself not refering to a transient

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
Hi Greg >> While you have done your very best to try to find and edge case << I'm not actually looking for a corner case here I'm just trying to find a way to implement what I currently need, but it does make me wonder about injecting dependencies into my domain. Surely there are circumstance

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
Hi Anne > Regarding your actual algorithm, it sounds like you're making > something very similar to soundex. Yes, it is basically that, for now at least. I will look at what algorithm I will use when I am happy with the approach. Pete http://mrpmorris.blogspot.com --~--~-~--~

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
Hi Fabio > You can configure NH to use the field (including the backfield of an > autoproperty) and don't have the setter. Thanks, I am aware of that, the problem is an OOP one really. If I don't have a setter then I wont be able to set the value without using a parameterised constructor, and

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Anne Epstein
Regarding your actual algorithm, it sounds like you're making something very similar to soundex. The soundex algorithm is pre-built into a number of databases (SQL Server at least, I'm sure of), and I'd bet is available elsewhere. Even if you don't decide to go with a premade implementation, it

[nhusers] Re: Mapping Explicit Interface Properties with Same Name

2009-03-26 Thread Joshua
That sure did it. Thanks again. This is going to make my life SO much easier. On Mar 26, 3:16 am, Stefan Steinegger wrote: > I really don't know, would have to try myself. Are there different > columns for the properties? You probably should try to define a column > name. > > On 26 Mrz., 05:19

[nhusers] Re: DB comments and description in NHibernate

2009-03-26 Thread Dario Quintana
I didn't say that.Since NHMA use the mapping schema to generate the attributes, the option should be there. Maybe after the definition maybe your class will be having more metadata than code. On Thu, Mar 26, 2009 at 10:21 AM, Utopico wrote: > > So it is a feature in the hbm-languague definition

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Fabio Maulo
Ken, in NH is even better because it respect a "sequence per table". An High is requested per sessionFactory per Persister... Example: Table-A: 101, 102,103,104..501,502 Table-B: 201, 202, 203, 204... 801,802 2009/3/26 Ken Egozi > the way I understand it: > > a generated 64bit ID wil

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Ken Egozi
I think that you can set Update=False, then the data will be selected and inserted, but not updated. with a readonly property and a factory method (or constructor) for setting the value for new instances you're set. On Thu, Mar 26, 2009 at 3:23 PM, Fabio Maulo wrote: > 2009/3/26 Peter Morris >

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Fabio Maulo
2009/3/26 Peter Morris > > This would work and is the kind of thing I would normally do, but in my > current ORM I can mark a property so that it can no longer be updated once > persisted so I can use this approach and still make Name immutible. In NH > I > am trying to make my classes complete

[nhusers] Re: DB comments and description in NHibernate

2009-03-26 Thread Utopico
So it is a feature in the hbm-languague definition but not as attributes? If so is it possible to add this feature to the attributes in an "easy" way? On 26 Mar, 13:09, Dario Quintana wrote: > Should be something like this in hbm-language > > To a table: > >     my customer comment here >    

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Greg Young
While you have done your very best to try to find and edge case I think even this can be done without injecting to the entity. I have found very very few circumstances where an entity needed a non-transient dependency to something. The ones that I have found tend to be infrastructure type cross cu

[nhusers] Re: DB comments and description in NHibernate

2009-03-26 Thread Dario Quintana
Should be something like this in hbm-language To a table: my customer comment here ... To a column: My Name comment here You should extrapolate this to those attributes, since are generated by the NH-schema, should be supported. The dialects with the option enabl

[nhusers] Re: DB comments and description in NHibernate

2009-03-26 Thread Ken Egozi
afaik, Description is not available on all main RDBMS, thus NH is not supporting it. On Thu, Mar 26, 2009 at 11:47 AM, Utopico wrote: > > I am working on a project where the database should be documented. I > am looking for a way to use hibernate to define this in hibernate. I > am using attri

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Tuna Toksoz
Yes. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Thu, Mar 26, 2009 at 11:40 AM, Ken Egozi wrote: > > as an outcome - every SessionFactory gets a range (using the HI) then > increments the LO o

[nhusers] DB comments and description in NHibernate

2009-03-26 Thread Utopico
I am working on a project where the database should be documented. I am looking for a way to use hibernate to define this in hibernate. I am using attributes on my classes to define my database (an example can be seen below). [NHibernate.Mapping.Attributes.Class(Table = "LINK")] public pa

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Ken Egozi
the way I understand it: a generated 64bit ID will consist of a HI and LO 32bit values (HI*32bit+LO) when a SessionFactory kicks in, it requests (and increments) the HI from the DB. as an outcome - every SessionFactory gets a range (using the HI) then increments the LO on each new entity. On

[nhusers] Re: Mapping Explicit Interface Properties with Same Name

2009-03-26 Thread Stefan Steinegger
I really don't know, would have to try myself. Are there different columns for the properties? You probably should try to define a column name. On 26 Mrz., 05:19, Joshua wrote: > Thanks Stefan. > > I'm now able to implement one of the interface properties explicitly, > but when I add the second

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
>> Haven't read the whole message (i will in a moment) but a quick answer would be did you try NH Search, or pure lucene indexing? << No, neither, but I am mainly interested in the conceptual part of the question :-) Thanks Pete http://mrpmorris.blogspot.com --~--~-~--~~--

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Peter Morris
> It is the thing that you last said, when exhaust a new Hi value is obtained, Lo values are incremented everytime an object is persisted. < Ah I see, that makes sense. I am confusing it with the other approach where only the exact number of IDs are requested when an update is required. Pete

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Tuna Toksoz
Regardless of transaction thing, HiLo assignes Id BEFORE it is sent to database. No select is executed. If lo value is >maxLoValue then a new Hi is obtained but in another transaction. It is the thing that you last said, when exhaust a new Hi value is obtained, Lo values are incremented everytime

[nhusers] Re: Using Hi/Lo Generator

2009-03-26 Thread Peter Morris
> and as for the people asking about what the behaviour was - the simplest > thing is to setup a quick two-entity domain with hilo id, new one instance > of each, session.Save them both and peek into the generated data. As I am still at theory level and can't yet do that may I ask a question? :-

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Tuna Toksoz
Haven't read the whole message (i will in a moment) but a quick answer would be did you try NH Search, or pure lucene indexing? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Thu, Mar 26, 2009 at 1

[nhusers] Re: IoC into business class instances

2009-03-26 Thread Peter Morris
> Fabio gives the answer but do you really need to do it? Not sure :-) I have a Song class which has a Name property. When the user searches for a song I want to list songs with a similar name to what they entered rather than the exact string. To achieve this I am considering doing somethin