Re: [nhusers] Re: "Invalid object name 'dbo.hibernate_unique_key'."

2010-08-20 Thread Diego Mijelshon
NextValue should NOT be a PK (it shouldn't be indexed at all), because it will have a single row that will change constantly (in essence, it's simulating a sequence in databases that don't have them) Here's something on Lo values and separation of tables: http://stackoverflow.com/questions/2192449/

[nhusers] Re: Criteria API - how to query back one object when expressions use aliases and referenced objects?

2010-08-20 Thread Chris J
What does it return? On Aug 20, 1:09 pm, Melborp wrote: > Hej Chris, > > Thank you for taking the time to answer. > > I was thinking about projections, but wasnt really sure how to apply > it in this case. > > I tried your approach: > var query = _nHibernateSession.CreateCriteria() >            

[nhusers] Re: "Invalid object name 'dbo.hibernate_unique_key'."

2010-08-20 Thread nh_3478
Okay, just incase this isn't clear enough for others and to make sure I understand, I created a new table called HiValue and a PK field named NextValue and seeded it with a default value of 0. In my hbm file for OrderHeader I now have: HiValue NextValue The

Re: [nhusers] Re: Problem mixing table per class hierarchy with table per subclass

2010-08-20 Thread Diego Mijelshon
My suggestion is to flatten the hierarchy a little OR switch to a single strategy (table per subclass)... deep hierarchies with changing strategies are a pain to map and maintain. Diego On Fri, Aug 20, 2010 at 16:56, v64 wrote: > Thanks for your reply. The mapping file i originally posted

[nhusers] recommended BaseEntity

2010-08-20 Thread Raul Carlomagno
commonly in our applications we define a BaseEntity so our domain classes inherit from it, giving us a few advantages. have u got any BaseEntity to show me? mines is basic and i extracted ideas from other people, in the other side for example, i took a look to S#arp Architecture's BaseEntity, very

[nhusers] Dealing with iCal-style events

2010-08-20 Thread Trinition
We're about to embark upon some calendaring functionality in our NHibernate-based system. The iCal format is certainly good for interchange, but what about storage? It doesn't seem right to map the events and reccurenc patterns to columns as CLOBs. An event starting on Jan 1, 2011 with recurrenc

RE: [nhusers] "Invalid object name 'dbo.hibernate_unique_key'."

2010-08-20 Thread Frans Bouma
http://www.nhforge.org/doc/nh/en/#mapping-declaration-id-generator see the snippet below 'hilo'. you have to create a table for the number and add a row. FB > -Original Message- > From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf > Of nh_3478 > Sent: vrij

[nhusers] "Invalid object name 'dbo.hibernate_unique_key'."

2010-08-20 Thread nh_3478
I get a genericadoexception with error {"could not get or update next value[SQL: ]"} and InnerException: "Invalid object name 'dbo.hibernate_unique_key'." I am following, to the T, the Nhibernate 2 book by Aaron Cure. //mssql 2008 express edition with table OrderHeader PK = Id, type = int then t

[nhusers] Re: Problem mixing table per class hierarchy with table per subclass

2010-08-20 Thread v64
Thanks for your reply. The mapping file i originally posted had a bug in it where EndangeredAnimal was under Animal when it should have been under WildAnimal. Here's the fixed file:

Re: [nhusers] Problem mixing table per class hierarchy with table per subclass

2010-08-20 Thread Diego Mijelshon
>From NH's mapping point of view, it doesn't matter that IberianLynx extends EndangeredAnimal, as it's seen as an Animal subclass. Also, you can have many s, so NH wouldn't know where to put it. You can probably specify the same join in IberianLynx, although schema generation might fail. Diego

[nhusers] Re: Criteria API - how to query back one object when expressions use aliases and referenced objects?

2010-08-20 Thread Melborp
Hej Chris, Thank you for taking the time to answer. I was thinking about projections, but wasnt really sure how to apply it in this case. I tried your approach: var query = _nHibernateSession.CreateCriteria() .Add(c => c.Unit.Id == unitId) .Add(c => c.StatusId > 7

[nhusers] Problem mixing table per class hierarchy with table per subclass

2010-08-20 Thread v64
I'm trying to map a deep class hierarchy and having trouble getting the desired mapping. Here's an example: Classes: namespace Animals { public class Animal { public string SpeciesName { get; set; } } public class DomesticAnimal : Animal { public string Name {

[nhusers] Re: Criteria API - how to query back one object when expressions use aliases and referenced objects?

2010-08-20 Thread Chris J
Does it work query the relationships from the other direction? I tried building a similar query with my own domain model, but the relationships weren't quite the same. Here's what I was thinking, not sure if it will work. This is with lambda extensions, but without creating aliases. var query = s

Re: [nhusers] Re: NHibernate in Action audit logging example does not work

2010-08-20 Thread Diego Mijelshon
You don't need to bypass anything. You have to check the type of the entity that's being saved; if it's your log entry type, then return. Diego On Fri, Aug 20, 2010 at 14:12, Chris J wrote: > > Since the event listener is hooked into the session factory, won't > this create a recursion? Th

Re: [nhusers] is NHibernate using the ThreadPool?

2010-08-20 Thread Diego Mijelshon
NH does not use the ThreadPool. The ADO.NET providers... who knows. Diego On Fri, Aug 20, 2010 at 04:30, Frank wrote: > I don't know if it can be answered but is NHibernate using the > ThreadPool for internal stuff? I'm about to dump loads of work in the > pool and am thinking about possib

[nhusers] Re: NHibernate in Action audit logging example does not work

2010-08-20 Thread Chris J
Since the event listener is hooked into the session factory, won't this create a recursion? The session.Save will trigger the listener again while still in the listener. I need a session that bypasses the event listener configuration. On Aug 20, 9:45 am, Valeriu Caraulean wrote: > You have cur

[nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread MattO
Okay, scratch the last question. Using FluentConfiguration is the best way to go!!! I love this! This is probably the most flexible validation framework i've ever seen! I've already implemented this into my base classes. I'll share the code incase anyone else has to do something similar. My on

Re: [nhusers] Re: Is there a way to change the this_ alias in nHibernate?

2010-08-20 Thread Tuna Toksoz
perhaps one can use interception? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Fri, Aug 20, 2010 at 12:39 PM, Diego Mijelshon wrote: > I can certainly be sorry for his pain (I'm a little young t

Re: [nhusers] Re: Is there a way to change the this_ alias in nHibernate?

2010-08-20 Thread Diego Mijelshon
I can certainly be sorry for his pain (I'm a little young to have shared it), but unfortunately NHibernate is not optimized for that kind of (sick) structure. Diego On Fri, Aug 20, 2010 at 12:58, John Davidson wrote: > If you have ever worked in an IBM Mainframe/legacy environment you shou

[nhusers] Deadlock priority

2010-08-20 Thread Graham Hay
Is there any way to get NH to emit a deadlock hint? e.g. for SQL server "SET DEADLOCK_PRIORITY LOW". I have googled it, to no avail, and searched for "deadlock" in the source :) At the moment I'm just executing a raw SQL query. Thanks, Graham -- You received this message because you are subscri

[nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread MattO
One more quick question, can you use a mixture of the FluentConfiguration of a validationengine and also still have it check the attribute flags as well (such as [NotNull] attributes), or are you forced to go entirely via the fluent configuration and use Defines, Satisfy, etc instead of Attributes

[nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread MattO
Thanks fabio, I was able to get this working with the ValidateInstance.By command and using a ValidationDef on my entity. I just need to play around with this more and see if I can figure out how to roll this into the classes I already have made. On Aug 20, 10:48 am, Fabio Maulo wrote: > On Fri,

Re: [nhusers] Re: Is there a way to change the this_ alias in nHibernate?

2010-08-20 Thread John Davidson
If you have ever worked in an IBM Mainframe/legacy environment you should have some empathy for MattO. The db he is using may have been developed 20+ years ago and because of you IBM Mainframes work with dependancies, is less changable than any other known environment. His concerns about bandwidt

Re: [nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread Fabio Maulo
On Fri, Aug 20, 2010 at 12:44 PM, MattO wrote: > Well this has gone over my head... Do you need to be using Fluent > nHibernate to use this? I'm using hbm XML files for everything... > > http://fabiomaulo.blogspot.com/search/label/Validator -- Fabio Maulo -- You received this message because

Re: [nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread Valeriu Caraulean
No, why? FluentConfiguration class is from NHibernate.Validator. On Fri, Aug 20, 2010 at 5:44 PM, MattO wrote: > Well this has gone over my head... Do you need to be using Fluent > nHibernate to use this? I'm using hbm XML files for everything... > > On Aug 20, 10:36 am, Fabio Maulo wrote: >

Re: [nhusers] Re: NHibernate in Action audit logging example does not work

2010-08-20 Thread Valeriu Caraulean
You have current session in listener. Then: private static void Save(IAuditLogEntry auditLogEntry, ISession session) { session .GetSession(EntityMode.Poco) .Save(auditLogEntry); } On Fri, Aug 20, 2010 at 5:41 PM, Chris J wrote: > > I am only aware of the one version of NHibernate in Action, co

[nhusers] Re: NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread MattO
Well this has gone over my head... Do you need to be using Fluent nHibernate to use this? I'm using hbm XML files for everything... On Aug 20, 10:36 am, Fabio Maulo wrote: > Congratulation Valeriu. > > MattO, > We don't have formal documentation for NHV btw I have posted a series > exposing all

[nhusers] Re: NHibernate in Action audit logging example does not work

2010-08-20 Thread Chris J
I am only aware of the one version of NHibernate in Action, covering 1.2. Yes, I reviewed the Audit Log implementation, which was a helpful example of how to use event listeners instead of an IInspector implementation. However, the piece that I'm curious about, which is not covered, it how to use

Re: [nhusers] Re: Is there a way to change the this_ alias in nHibernate?

2010-08-20 Thread Diego Mijelshon
The problem is, NHibernate is not well designed for 300baud teletypes. It's meant to be used in local networks. If you have remote clients, they should be using a service exposed through REST, WCF, or whatever buzzword of the day you like the most. Also, you are failing to consider things like net

Re: [nhusers] NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread Fabio Maulo
Congratulation Valeriu. MattO, We don't have formal documentation for NHV btw I have posted a series exposing all features of NHV. On Fri, Aug 20, 2010 at 12:20 PM, Valeriu Caraulean wrote: > If you were using ValidationDef you can make a trick and use > ValidateInstance method to resolve valida

[nhusers] Re: upgrading from hibernate 1.2 to 2.1.2

2010-08-20 Thread AAD
by downloading the 3.0 and source I am able to use VS - thanks- not sure what has been changed but at least I can begin to debug thanks for the help On Aug 20, 10:07 am, AAD wrote: > I have the source for 2.1.2- also, I thought 3.0 was still in alpha > testing- > I will download 3.00 and see if I

Re: [nhusers] NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread Valeriu Caraulean
If you were using ValidationDef you can make a trick and use ValidateInstance method to resolve validators from container. You're asking about attributes, so: the solution that worked earlier for us: You can ry implement IConstraintValidatorFactory that will be resolving components trough container

[nhusers] Re: Is there a way to change the this_ alias in nHibernate?

2010-08-20 Thread MattO
It's just one of those optomization tricks that could be done which is why I ask if it "could" be done. Here is a theoretical bandwidth savings computation: Single table with 100 fields. You retrieve all of them. Total bandwidth consumption per query due to "this_" table alias = 100 * 5 bytes=

[nhusers] Re: upgrading from hibernate 1.2 to 2.1.2

2010-08-20 Thread AAD
I have installed 3.0 and still have the same problem- I have the source download for 3.0 also On Aug 20, 10:07 am, AAD wrote: > I have the source for 2.1.2- also, I thought 3.0 was still in alpha > testing- > I will download 3.00 and see if I see a difference- > thanks > > On Aug 20, 9:51 am, Joh

[nhusers] Re: NHibernate reconizes registered keyword but not using them?

2010-08-20 Thread Mike
Looks like I can't modify my message. To add I am using NH v2.1.2.4000. On Aug 20, 11:05 am, Mike wrote: > I created a custom dialect and told NH to use it. From there I > registered a few keywords so I could use it with HQL. > > public class CustomDialect : Oracle10gDialect > { >         public

[nhusers] Re: upgrading from hibernate 1.2 to 2.1.2

2010-08-20 Thread AAD
I have the source for 2.1.2- also, I thought 3.0 was still in alpha testing- I will download 3.00 and see if I see a difference- thanks On Aug 20, 9:51 am, John Davidson wrote: > This is in 2 parts. First to step through CollectionBinder.cs you will need > the source code for NH2.1.2 rather than

[nhusers] NHibernate reconizes registered keyword but not using them?

2010-08-20 Thread Mike
I created a custom dialect and told NH to use it. From there I registered a few keywords so I could use it with HQL. public class CustomDialect : Oracle10gDialect { public CustomDialect() { RegisterKeyword("start"); RegisterKeyword("with");

[nhusers] Re: New blog

2010-08-20 Thread Tom Bushell
On Aug 19, 2:27 pm, Diego Mijelshon wrote: > Don't congratulate me yet... wait to see if I keep writing there :-D I hope you do - your first two posts are very informative, concise, and well written! -Tom > >     Diego > > > > On Thu, Aug 19, 2010 at 15:05, Fabio Maulo wrote: > > Congratulat

Re: [nhusers] upgrading from hibernate 1.2 to 2.1.2

2010-08-20 Thread John Davidson
This is in 2 parts. First to step through CollectionBinder.cs you will need the source code for NH2.1.2 rather than just the binaries. The second part is a recommendation to do your conversion to NH3 as it will not be any more painful, and may be less due to numerous other bug fixes. John Davidso

[nhusers] Re: 'Could not synchronize database state with session' causeed by MessageQueue

2010-08-20 Thread Ollie Riches
Sorted :) I wasn't flushing the session in my UOW when commit was called. On Aug 20, 3:40 pm, Ollie Riches wrote: > I think the important detail for the exception is: > > 2010-08-20 15:27:22,563 [6] ERROR NHibernate.Impl.AbstractSessionImpl > - DTC transaction prepre phase failed > System.Tran

[nhusers] Re: 'Could not synchronize database state with session' causeed by MessageQueue

2010-08-20 Thread Ollie Riches
I think the important detail for the exception is: 2010-08-20 15:27:22,563 [6] ERROR NHibernate.Impl.AbstractSessionImpl - DTC transaction prepre phase failed System.Transactions.TransactionException: The operation is not valid for the state of the transaction. ---> System.Data.SqlClient.SqlExcep

[nhusers] 'Could not synchronize database state with session' causeed by MessageQueue

2010-08-20 Thread Ollie Riches
I'm receiving the following error when I started using MessageQueue inside a TransactionScope transaction - any ideas why this is happening, I realise the transaction is now getting prompted to a distributed transaction and hence have turned on and configured MSDTC. I suspect this is something to

[nhusers] NHibernate Validator with custom validator - How do you retrieve entity information??

2010-08-20 Thread MattO
I have created a custom validator that I wish to put on one of my business objects attributes to do validation before an object is persisted to the database. In order for validation to be successful though I need to be able to pass in the variable to the custom validator, it is NOT a constant like

[nhusers] upgrading from hibernate 1.2 to 2.1.2

2010-08-20 Thread AAD
I am getting a mapping error on a select . Error is: Association references unmapped class This works in 1.2.2 and I have checked the hbm.xml and it has "Embedded Resource" and "do Not copy" set on- I have looked at the mapping dll and I can see the table there- with other tables that do work (oth

[nhusers] Re: Having a problem with db2 mapping

2010-08-20 Thread rhartzog
I don't know what I was doing last night, but it works this morning after re-entering the connection string with CharBitDataAsString=TRUE. Maybe I had a typo that I didn't see because my eyes were crossing. Thank you very much for the help MattO. On Aug 19, 9:36 pm, MattO wrote: > I'm using 2.1

[nhusers] Re: Anonymous Types

2010-08-20 Thread Dietrich
"select Name, Surname from Record where x = y" It will be returned as an Object[], which isn't as nice, but you can do this. You can also create a class that can accept this result, apply Aliases to the columns, and use an AliasToBeanTransfomer. On Aug 19, 4:20 am, osman nuri katib wrote: > I

[nhusers] Select from children

2010-08-20 Thread Kim Johansson
Hello there! I have the following model: class A { public virtual int Id { get; set; } public virtual ICollection B { get; set; } public virtual IEnumerable C { get; } } class B { public virtual int Id { get; set; } public virtual A A { get; set; } public virtual ICollection C { get;

Re: [nhusers] New blog

2010-08-20 Thread Sidar Ok
congratulations and keep up the courage :=) On Thu, Aug 19, 2010 at 8:27 PM, Diego Mijelshon wrote: > Don't congratulate me yet... wait to see if I keep writing there :-D > > Diego > > > > On Thu, Aug 19, 2010 at 15:05, Fabio Maulo wrote: > >> Congratulation and WELCOME to blogsfera >> >> On

Re: [nhusers] NHibernate in Action audit logging example does not work

2010-08-20 Thread Valeriu Caraulean
BTW, what version of NH the "NHibernate in Actions" describing? 1.2? Or 2.x? Have you looked at "Audit Log" implementation using event listeners from more recent versions of NH? It may turn to easier and just better solution. An example: http://nhforge.org/wikis/howtonh/creating-an-audit-log-using

[nhusers] is NHibernate using the ThreadPool?

2010-08-20 Thread Frank
I don't know if it can be answered but is NHibernate using the ThreadPool for internal stuff? I'm about to dump loads of work in the pool and am thinking about possible side effects like delaying other Timers and whatnot. I've tried limiting the pools maximum concurrent threads and saw some Timers

RE: [nhusers] Named Query in Oracle parameters

2010-08-20 Thread Frans Bouma
You open a cursor, but don't do anything with it, as you return 3 scalars. FB > I have the following named query for an Oracle database. When it is run I > get the error "Not all named parameters have been set". I think it could be > the : characters used in the assignment but am not sur