[nhusers] Re: Write only property for legacy database

2010-02-18 Thread Alex McMahon
Intereting... I know this is sort of the wrong place to ask, but how do I do this in Fluent NH? I've tried .ReadOnly() but I then get an error message about there not being a setter... I've also tried. Access.various but there doesn't seem to be one called ReadOnly... any ideas? On Feb 17, 11:29 

[nhusers] Found an small error in NHibernate source and included a possible fix

2010-02-18 Thread Basuitdelft
I did find a errors in the NHibernate source. In 'AbstractNullnessCheckNode.cs' and 'BinaryLogicOperatorNode.cs' files there are these lines: String[] splits = StringHelper.Split( , , nodeText ); If think the author wanted to make a sting like this value1, value2 to be split in 2 parts but the

[nhusers] Re: Update on parent object cause an insert on child objects

2010-02-18 Thread MiloszeS
Thank you for an answer Fabio. I've just resolved my problem. In the mean time I realized, that the entity load and entity session has been done in two seperate sessions. After entities load the session has been cleared and disposed. After that some operations on the entities collection has been

[nhusers] Re: How to get an entity/mapping + relation tree?

2010-02-18 Thread mynkow
No, I don't wanna do this. I want to get the whole GRAPH of an entity. You know, the class structure, relations to other entities. I am not talking about data but schema of .NET types. I don't know how to describe this with other words. If you dont know what is a graph check wikipedia On Feb 17,

[nhusers] Re: Found an small error in NHibernate source and included a possible fix

2010-02-18 Thread kor
hi, use jira to send bug and/or bugfix at http://jira.nhforge.org (it's more easy to manage them with jira) note: in this days the server is down for maintenance, so wait same days when it will be up to send your bug and bugfix -- You received this message because you are subscribed to the

[nhusers] Re: Should I use int or System.Int32??

2010-02-18 Thread haarrrgh
I know that there's no difference in .net, but I wanted to make sure there's no difference in NH as well. Thank you guys! -- You received this message because you are subscribed to the Google Groups nhusers group. To post to this group, send email to nhus...@googlegroups.com. To unsubscribe

Re: [nhusers] Mapping enum 0 to null in database

2010-02-18 Thread Diego Mijelshon
In any case, you should use a nullable enum property instead of a NONE value. My impression is that you are designing your domain based on display concerns. Diego On Thu, Feb 18, 2010 at 00:46, Fabio Maulo fabioma...@gmail.com wrote: IUserType if you have time to implements it otherwise

[nhusers] NamedQuery Problem

2010-02-18 Thread Kevin Fairclough
I'm getting the following error with a named query, on Session start. NHibernate.QueryException: No column name found for property [Id] for alias [hp] [select iteminhier0_.Id as {h.Id}, itemlookup1_.Id as {i.Id}, itemlookup2_.Id as {p.Id},

Re: [nhusers] CriteriaTransformer.TransformToRowCount doesnt work with Aggregate Queries

2010-02-18 Thread Diego Mijelshon
I'm just thinking* it might be easier to do this with HQL Diego *: I didn't try On Wed, Feb 17, 2010 at 15:03, Scott White scott.w.wh...@gmail.com wrote: Using version 2.1.0.4 Since the following code clears the projection before adding the rowcount as a projection if the target query

Re: [nhusers] NHibernate.Linq select bug

2010-02-18 Thread Diego Mijelshon
Next time, it would be better if you stated what the bug is, the context, etc. Anyway, I ran it and it tries to use the constant string in an incorrect way, so that's probably unsupported in 2.x. Have you tried with 3.x (trunk)? Diego On Wed, Feb 17, 2010 at 06:13, Rikard Pavelic

[nhusers] Fwd: Many to many with extra system columns(Lastupdateduser,timestamp etc..)

2010-02-18 Thread Diego Mijelshon
Copying answer to Sravan, I didn't see he replied to me privately -- Forwarded message -- Date: Wed, Feb 17, 2010 at 21:41 To: sravan sravan.surabhi.ku...@gmail.com Well, that's the problem with sql-insert If it hurts when you do that, stop doing it Go with the intermediate

[nhusers] SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Marco
Hello, I'm trying to use the NHIbernate SchemaUpdater (NHibernate .Tool .hbm2ddl .SchemaUpdate). If I call schemaUpdate.execute(true,true) the function will block the program for appr. 5 minutes, then output sql-commands but doesn't apply them to the database. and the sql- commands does update

Re: [nhusers] Using guid.comb to create sequential IDs in distributed environment

2010-02-18 Thread Robert Rudduck
GUIDs themselves have a fairly low chance of reptition although it does happen. Unfortunately the Guid.Comb algorithm breaks down quickly when is distributed situations such as the one you are describing (read the comments from here:

Re: [nhusers] SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Robert Rudduck
Do you have the connection string right? Sounds like NH might not be looking in the right place, so it thinks all the tables are new... On Thu, Feb 18, 2010 at 7:41 AM, Marco irresponsible.philosop...@googlemail.com wrote: Hello, I'm trying to use the NHIbernate SchemaUpdater (NHibernate

Re: [nhusers] Schema Management Tool

2010-02-18 Thread Diego Mijelshon
Dave, Nice work! Contributions are always welcome in healthy open source communities. My suggestion is that you host the project on Google Code or SourceForge (I prefer the former), with a reasonable license (NH itself uses LGPL). Good luck! Diego 2010/2/17 newman.de newman...@gmail.com

Re: [nhusers] Re: How to get an entity/mapping + relation tree?

2010-02-18 Thread Robert Rudduck
If you just want to do this, you really don't need NHibernate. Just do a traversal of the properties using reflection. Pusedo code would looks something like: create a queue enqueue the type of the root entityType while the queue is not empty - get all the properties and their property type -

[nhusers] Re: SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Marco
Unfortunatly there were no results. It runs for 5 minutes, outputs everthing to the console and applies nothing. On 18 Feb., 15:22, Marco irresponsible.philosop...@googlemail.com wrote: I think the connection string is right, but maybe I have to add database to it - actually I don't need it

Re: [nhusers] Re: SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Robert Rudduck
Well the console part is because you have the first paramater (script) set to true. Not sure why it isnt outputting though. Does SchemaExport work to create the schema initially with that same connection string? On Thu, Feb 18, 2010 at 8:47 AM, Marco irresponsible.philosop...@googlemail.com

Re: [nhusers] Using guid.comb to create sequential IDs in distributed environment

2010-02-18 Thread Fabio Maulo
There is another option http://fabiomaulo.blogspot.com/2009/02/nh210-new-generators.html http://fabiomaulo.blogspot.com/2009/02/nh210-new-generators.htmlsee : guid.native 2010/2/18 Robert Rudduck rob...@rpowered.net GUIDs themselves have a fairly low chance of reptition although it does

Re: [nhusers] Re: Write only property for legacy database

2010-02-18 Thread Robert Rudduck
You could set the access to use a private field and not put a setter on the property. ReadOnly means that any update wont be written out, but it still requires a setter of some sort so NHibernate can initialize it. On Thu, Feb 18, 2010 at 2:12 AM, Alex McMahon fluxmu...@gmail.com wrote:

[nhusers] Re: SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Marco
It actually IS outputting, but it does not apply that to the database, sorry if I didn't get myself clear enough. If I try with SchemaExport it works fine, with the same connection string. What confuses me most is that for the first 5 minutes (I'm not kidding here!) nothing seems to happen.

Re: [nhusers] Re: SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Robert Rudduck
Very interesting, I haven't seen that behavior before. You might try stepping through it if you have the source, it might be a bug. I am assuming you have tested all your mappings and those work correctly? On Thu, Feb 18, 2010 at 9:00 AM, Marco irresponsible.philosop...@googlemail.com wrote:

[nhusers] Re: SchemaUpdater (NHibernate Tools)

2010-02-18 Thread Marco
Yeah, it all works fine, the code before and after is executed well and the mappings are ok. I use NHibernate throughout the complete application, reading and writing data all the time and everything is just fine. If I don't get this to work I have to find resp. write a workaround, so I'd better

Re: [nhusers] Re: Write only property for legacy database

2010-02-18 Thread Fabio Maulo
You have another option if FNH does not support access=readonly. Ask the feature to FNH team ;) 2010/2/18 Robert Rudduck rob...@rpowered.net You could set the access to use a private field and not put a setter on the property. ReadOnly means that any update wont be written out, but it still

[nhusers] Re: CriteriaTransformer.TransformToRowCount doesnt work with Aggregate Queries

2010-02-18 Thread Scott White
I agree it probably would be. However my code is actually called by DAOs to create a wrapper around them for pagination. This use case is fairly documented and the documented solutions work EXCEPT in this scenerio. I'm working on manually constructing the SQL from the criteria expression right

[nhusers] Re: How to get an entity/mapping + relation tree?

2010-02-18 Thread mynkow
Yes, I can. But why should I use reflection when NHibernate already loaded that information? Well I simply want to know which NHibernate's class contains this info. I dont want alternative ways of doing this. On Feb 18, 4:46 pm, Robert Rudduck rob...@rpowered.net wrote: If you just want to do

[nhusers] setup nHibernate from a WebProject in another windows application project

2010-02-18 Thread Sheri
Hi All! I have designed I web application. I have user Castle Windsor / nHibernate/ASP .NET MVC 1.0. Now I have got another thing. to fix an ADMIN TOOL in a windows application. How can I use all the database settings in my web app in the windows application? I am almost confused. I know I can

[nhusers] lazy-loading fails when session got disconnected

2010-02-18 Thread taoufik
We use one (read-only) session which we disconnect as soon as we retrieve the data from the database. The data retrieved, often has lazy-loaded properties which are not initialized yet. When we try to access the properties, the following exception gets thrown:

[nhusers] query criteria for an entity and possibly a subclass in the same query

2010-02-18 Thread Nicholas Becker
This is the setup for my 2 entities: public class Person { public Guid Id {get;set;} public string Name {get;set;} } public class Immortal : Person { public string DarkName {get;set;} } Here's what their mapping looks like: class name=Person id name=Id generator class=guid.comb/

[nhusers] Polymorphic HQL any association issue

2010-02-18 Thread Sergey Ishchenko
Hi! I've got two simple classes ClassA and ClassB mapped with table-per- concrete-class strategy. IssueClass can contain a reference to ClassA or to ClassB. Here is the mapping file: ?xml version=1.0 encoding=utf-8 ? hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 assembly=HqlIssue

[nhusers] Implement own IsDirty in nHibernate

2010-02-18 Thread taoufik
For my current project, we use a nHibernate session to retrieve the object, and another session to update the changes we've made to the object in between the two session. If we use SaveOrUpdate(), nHibernate will typically do a select-then-update (so, two calls to the database). However, our own

Re: [nhusers] Polymorphic HQL any association issue

2010-02-18 Thread Fabio Maulo
Association.class = .. 2010/2/18 Sergey Ishchenko s.a.ishche...@gmail.com Hi! I've got two simple classes ClassA and ClassB mapped with table-per- concrete-class strategy. IssueClass can contain a reference to ClassA or to ClassB. Here is the mapping file: ?xml version=1.0

Re: [nhusers] Polymorphic HQL any association issue

2010-02-18 Thread Fabio Maulo
sorry... was too short An any type has the special properties id and class, allowing us to express a join in the following way (where AuditLog.Item is a property mapped with any). from Eg.AuditLog log, Eg.Payment payment where log.Item.class = 'Eg.Payment, Eg, Version=...' and log.Item.id =

Re: [nhusers] lazy-loading fails when session got disconnected

2010-02-18 Thread Oskar Berggren
I think this can be resolved by not disconnecting manually. Unless you're in a transaction, the ISession will automatically release the DbConnection back to the pool anyway. /Oskar 2010/2/18 taoufik taoufik.zam...@fortisinvestments.com: We use one (read-only) session which we disconnect as

SV: [nhusers] Implement own IsDirty in nHibernate

2010-02-18 Thread Roger Kratz
It might not suit you at all... In some use cases in our fat client we use something like this... aggRoot = fetchUsingSession1(); clonedAgg = aggRoot.Clone(); [...] aggRoot.Something=changedValue; [...] session2.Lock(clonedAgg, lockmode.none); session2.Merge(aggRoot); We need to clone the

[nhusers] Re: lazy-loading fails when session got disconnected

2010-02-18 Thread taoufik
Interesting to know that the session does a db connection management itself. Is there a way to demonstrate when the session will automatically disconnect if not in a transaction? On Feb 18, 5:26 pm, Oskar Berggren oskar.bergg...@gmail.com wrote: I think this can be resolved by not disconnecting

[nhusers] Re: lazy-loading fails when session got disconnected

2010-02-18 Thread taoufik
It seems that the option you're talking about (called in hibernate: 'connection.release_mode' = 'after_statement') is not supported by nHibernate. A piece of code from nhibernate source: private static ConnectionReleaseMode ParseConnectionReleaseMode(string name) {

Re: [nhusers] Re: Write only property for legacy database

2010-02-18 Thread Diego Mijelshon
Beat you to it by 12 minutes. And I'm beggining to use your style, too. I'm worried :-) Diego 2010/2/17 Fabio Maulo fabioma...@gmail.com access=readonly 2010/2/17 Alex McMahon fluxmu...@gmail.com Fabio, Thanks for your reply... I don't quite understand what you mean... I think

Re: [nhusers] Re: Write only property for legacy database

2010-02-18 Thread Diego Mijelshon
Not sure about FNH, but using hbm mappings you don't need a setter if you declare a property with access=readonly. NH will keep track of the DB value, do dirty checks with it and issue the appropriate updates to the DB. Diego P.S. I'm writing this offline, sorry if somebody already answered

Re: [nhusers] Mapping enum 0 to null in database

2010-02-18 Thread Mohamed Meligy
I think the simplest way to implement this (regardless of whether it's right thing or what reasons make you ask for it) is to map a nullable enum FIELD, and make a property (that is NOT mapped in NH), which reads and writes the field value. something like: * * *//Mapped in NH, nullable private

[nhusers] NHibernate 3 Roadmap

2010-02-18 Thread Paul
I'm excited about the new features coming out in NHibernate 3 and wanted to know what the anticipated roadmap is for this version and an anticipated date it will be officially released. -- You received this message because you are subscribed to the Google Groups nhusers group. To post to this

[nhusers] Re: Jira down for maintenance

2010-02-18 Thread Fabio Maulo
JIRA up again at http://216.121.112.228 we will adjust it to http://jira.nhforge.org/ soon Thanks to be patient. 2010/2/16 Fabio Maulo fabioma...@gmail.com Our JIRA will be down for a while. Be patient. -- Fabio Maulo -- Fabio Maulo -- You received this message because you are

Re: [nhusers] NHibernate 3 Roadmap

2010-02-18 Thread Fabio Maulo
La tua ansia non puó modificare gli eventi ;) 2010/2/18 Paul paulyo...@gmail.com I'm excited about the new features coming out in NHibernate 3 and wanted to know what the anticipated roadmap is for this version and an anticipated date it will be officially released. -- You received this

Re: [nhusers] Mapping enum 0 to null in database

2010-02-18 Thread Fabio Maulo
Good tip. btw the mapping should be to the property; for the provided example it look as: property name=Column access=camelcase-underscore/ 2010/2/18 Mohamed Meligy eng.mel...@gmail.com I think the simplest way to implement this (regardless of whether it's right thing or what reasons make you

Re: [nhusers] Mapping enum 0 to null in database

2010-02-18 Thread Fabio Maulo
sorry access=field.camelcase-underscore 2010/2/18 Fabio Maulo fabioma...@gmail.com Good tip. btw the mapping should be to the property; for the provided example it look as: property name=Column access=camelcase-underscore/ 2010/2/18 Mohamed Meligy eng.mel...@gmail.com I think the

[nhusers] Cant persist IListstring: NHibernate.MappingException : No persister for: System.String

2010-02-18 Thread JohnRudolfLewis
In my entity class I have the following property: public virtual IListstring Tags { get; private set; } In my fluent nhibernate mapping file, I have the following mapping: HasMany(x = x.Tags) .Table(ProductTags) .Element(Tag) .AsBag(); Which

[nhusers] Re: Cant persist IListstring: NHibernate.MappingException : No persister for: System.String

2010-02-18 Thread JohnRudolfLewis
Nevermind. the problem was in the way that Fluent NHibernate's PersistenceSpecification test was interacting with the entity. Not sure what the bug is, but when I save the entity by directly calling session.Save, it works fine. On Feb 18, 6:56 pm, JohnRudolfLewis johnrle...@gmail.com wrote:

Re: [nhusers] Re: Write only property for legacy database

2010-02-18 Thread Fabio Maulo
eh? 2010/2/18 Diego Mijelshon diegosebast...@gmail.com Beat you to it by 12 minutes. And I'm beggining to use your style, too. I'm worried :-) Diego 2010/2/17 Fabio Maulo fabioma...@gmail.com access=readonly 2010/2/17 Alex McMahon fluxmu...@gmail.com Fabio, Thanks for your