[nhusers] dba insert into hilo tables

2009-07-01 Thread cws
hi! Having a schema using hilo. What is the best way to allow inserts outside the app by for example a dba using ssms? I guess i could implement hilo in tsql? Please let me know if you had any experience with this Regards --~--~-~--~~~---~--~~ You received this

[nhusers] Paging error: The column xxx was specified multiple times for query

2009-07-01 Thread Dave
I have made a Generic class that adds paging and criteria. When I call criteria.SetMaxResults(limit.Value).SetFirstResult(start.Value); I get the error The column xxx was specified multiple times for query Is this bug in nHibernate v2.0.1 ? or my own bug? I had similar code using a

[nhusers] Re: How to handle default entities

2009-07-01 Thread Caio Kinzel Filho
Have you found a solution for that already? On Mon, Jun 22, 2009 at 4:47 AM, David Perforsdnperf...@gmail.com wrote: Sure no problem, will do it this week... On Jun 19, 3:21 pm, Fabio Maulo fabioma...@gmail.com wrote: 2009/6/19 David Perfors dnperf...@gmail.com Instead of using the

[nhusers] Mapping a relation not on primary key

2009-07-01 Thread Maik
Hi folks, I have a question, because I couldn't find it by flying through the manual and google. How do I map a relation on a UniqueKey in the foreign Table? I mean sth. like this: TABLE1: ID *(PK) BUSINESS_ID (Unique or NULL) NAME TABLE2: ID *(PK) MY_TAB1 (FK to TABLE1 by BUSINESS_ID)

[nhusers] Re: Why cascade does not working ?

2009-07-01 Thread Oskar Berggren
2009/7/1 Fernando Zago nan...@gmail.com: I made the changes in the entity, but i don't want that nhibernate persist them. I want nhibernate to persist what is cascade=save-update. The cascade has to do with your root having or gaining reference to objects that are not already persisted, or

[nhusers] Re: newbie question what do i need to do to enable database deletion on unit test setup

2009-07-01 Thread Oskar Berggren
Look up connection pooling (ADO.NET, below NHibernate) and how to turn this off for the Firebird ADO.NET driver. This is possibly a parameter in you connection string. /Oskar 2009/6/30 theghost theghost...@gmail.com: Hi, As part of learning nhibernate i am trying to set up some basic unit

[nhusers] Re: newbie question what do i need to do to enable database deletion on unit test setup

2009-07-01 Thread theghost
Thanks that was it: Pooling=false; added to connection string fixed it! On Jul 1, 5:22 pm, Oskar Berggren oskar.bergg...@gmail.com wrote: Look up connection pooling (ADO.NET, below NHibernate) and how to turn this off for the Firebird ADO.NET driver. This is possibly a parameter in you

[nhusers] NHibernate SQL Generation Issue

2009-07-01 Thread naz
Hi, I get this error when executing the generated SQL - Ambiguous column name. It seems somehow the latest version of Castle I downloaded does not alias the order by clause. The old version use to work but this seems like a possible bug in the latest version of NHibernate. Anyone else

[nhusers] One to Many Newbie Question

2009-07-01 Thread usbsnowcrash
I have two tables Game and Genre. Each game can have 0 or more genres. I have a table that manages this mapping that has a composite key pointing back to the primary keys on Game and Genre. Here is a visual: Game -- *GameID GameName GameGenres -- *GameID *GenreID

[nhusers] Re: One to Many Newbie Question

2009-07-01 Thread Dave
Read this article it explains most of the different mappings with examples http://www.codeproject.com/KB/database/Nhibernate_Made_Simple.aspx On Jul 1, 10:22 am, usbsnowcrash jeffery.ye...@gmail.com wrote: I have two tables Game and Genre. Each game can have 0 or more genres. I have a

[nhusers] Re: What's the point of inverse=false?

2009-07-01 Thread Roger
What I don't get is this: when would you NOT want to use inverse=true on a one-to-many relationship? In monodirectional relationships. I would guess the reason this is not happening by default in bidirectional one-to-many refs is to have consistent behaviour with other mappings such as

[nhusers] Re: Mapping a relation not on primary key

2009-07-01 Thread Stefan Steinegger
You should actually avoid this. If have to cope with a legacy database, use property-ref: class Class1 { //... public Guid BusinessId { get; set; } } class Class2 { //... public MyClass1 { get; set; } } class name=Class2 table=TABLE2 !-- ... -- many-to-one name=MyClass1

[nhusers] Re: Mapping a relation not on primary key

2009-07-01 Thread Maik
I know, that this is a bad design, but we also use a legacy database. Thanks for your help! On 1 Jul., 12:04, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: You should actually avoid this. If have to cope with a legacy database, use property-ref: class Class1 {   //...   public

[nhusers] Defining a user type for decimal with precision

2009-07-01 Thread Stefan Steinegger
I have a user type which specifies a decimal with precision and scale like this: public IType[] PropertyTypes { get { return new [] { TypeFactory.GetDecimalType(36, 18), TypeFactory.GetStringType(100)

[nhusers] Using guid.comb for character(36)

2009-07-01 Thread Kenneth Siewers Møller
Hi This might be a simple question to answer, but here goes. We're running a PostgreSQL 8.1 DBMS, which doesn't support UUID. My idea is therefore to continue using GUID's as PK's in my domain model, but simply persist them as character(36) in the database. Is this possible? I've tried just

[nhusers] Re: Using guid.comb for character(36)

2009-07-01 Thread Ken Egozi
a guid is a 128bit numbercharacter(36) is 288. even if you skip the '-' chars you're still at 256. and if characters() is unicode ... using a too large field for indexing, especially for PK, might not be such a good idea. is there any kind of a binary[128] field you can use instead? then we'll

[nhusers] Re: Defining a user type for decimal with precision

2009-07-01 Thread Roger Kratz
There were some issues with decimal db type http://nhjira.koah.net/browse/NH-1594 Are you using latest nh bits? -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of Stefan Steinegger Sent: den 1 juli 2009 13:54 To: nhusers Subject: [nhusers]

[nhusers] Re: Defining a user type for decimal with precision

2009-07-01 Thread Stefan Steinegger
Thanks for the hint. I will test it with version 2.1 This is a major issue for us, because we are on 2.0 now and I have a user type just to make sure that the precision is on 36,18. If I need to declare the precision when ever I map a decimal, I have a lot of work and a maintenance problem too.

[nhusers] Re: Defining a user type for decimal with precision

2009-07-01 Thread Fabio Maulo
In NH2.0 you can use:type=Decimal(36,18) 2009/7/1 Stefan Steinegger stefan.steineg...@bluewin.ch Thanks for the hint. I will test it with version 2.1 This is a major issue for us, because we are on 2.0 now and I have a user type just to make sure that the precision is on 36,18. If I need

[nhusers] Re: How to handle default entities

2009-07-01 Thread David Perfors
A quick writeup can be found here: http://nhforge.org/wikis/howtonh/prefent-nhibernate-from-saving-default-relations.aspx On Jul 1, 8:33 am, Caio Kinzel Filho cai...@gmail.com wrote: Have you found a solution for that already? On Mon, Jun 22, 2009 at 4:47 AM, David Perforsdnperf...@gmail.com

[nhusers] Re: Using guid.comb for character(36)

2009-07-01 Thread Kenneth Siewers Møller
Hmm, unfortunately there isn't any binary column. I guess theres a byte array (bytea), but i don't know if that's any good. I can see your point in using character(36) is a bad idea, but I was simply just copying the guid generated from .NET (which includes the dashes), thinking that a plain

[nhusers] Where clause in mapping

2009-07-01 Thread ike bailey
I was reading the nhibernate reference guide to figure out how to map a table where a column is a certain value and i ran across this:5.1.3. class You may declare a persistent class using the class element: class name=ClassName (1) table=tableName

[nhusers] HQL / Critera query for self referencing table and order by

2009-07-01 Thread Graham Bunce
All, I'm trying to create the HQL to load an entity and all its children, ordering both and I'm struggling a little. It may be possible using Critera but I must admit I find those a little hard to understand so tend to use HQL. I have a self referencing table with data like the following

[nhusers] Re: HQL / Critera query for self referencing table and order by

2009-07-01 Thread Tuna Toksoz
Does this help? http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/05/14/how-to-map-a-tree-in-nhibernate.aspx Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 1, 2009 at 6:57 PM,

[nhusers] Re: Where clause in mapping

2009-07-01 Thread Fabio Maulo
Retrieve instances by query and not using Get nor Load nor inside a collection owned by another class and you will see how it work.Btw you must ask your self why use the 'where' in a class mapping. An example is here: http://fabiomaulo.blogspot.com/2008/10/power-of-orm.html Note: The use of

[nhusers] Re: Using guid.comb for character(36)

2009-07-01 Thread Kenneth Siewers Møller
Okay, the db type bytea is in fact binary data... So, with this in place, how can I persist a Guid in that? 2009/7/1 Kenneth Siewers Møller kenneth.siew...@gmail.com Hmm, unfortunately there isn't any binary column. I guess theres a byte array (bytea), but i don't know if that's any good. I

[nhusers] Re: HQL / Critera query for self referencing table and order by

2009-07-01 Thread Graham Bunce
Thanks Some interesting pointers (LEFT JOIN FETCH) which I've tried but the final option seems to be to drop down to raw SQL. I'd rather not and would rather face the complexities (to me anyway!) of criteria queries. Can this do the recursive (max 3 levels) with sorting that I'm after?

[nhusers] Re: Using guid.comb for character(36)

2009-07-01 Thread Fabio Maulo
2009/7/1 Kenneth Siewers Møller kenneth.siew...@gmail.com Okay, the db type bytea is in fact binary data... So, with this in place, how can I persist a Guid in that? Take care. The matter is not only the representation but how the DataProvider will interpret a Guid parameter. -- Fabio Maulo

[nhusers] Re: Using guid.comb for character(36)

2009-07-01 Thread Kenneth Siewers Møller
Well, I ended up creating a simple enhanced usertype converting from string to guid and vice verca... It's actually a very crude implementation, but does what is intended. Am I correct to assume that IEnhancedUserType is the right approach for a custom identifier type? 2009/7/1 Fabio Maulo

[nhusers] Problem with collection loading - unit test sometimes passes, sometimes not

2009-07-01 Thread epitka
I have a very unusual problem with one relationship in my class (and only this one) out of some 60 classes. Problem is that the unit test that tests mapping passes on my local machine, but fails on the build server. Mind you everything is pointing to the same database, problem is not with a data.

[nhusers] Composite-element with null columns in map is ignored

2009-07-01 Thread ernestmartin
Hello everyone. I'm trying make an entity containing a dictionary with their texts in several languages. To do this I created the product class that contains this simple properties: public virtual string Name { get; set; } public virtual IDictionaryCulture, CultureText

[nhusers] Property with Oracle´s sequence?

2009-07-01 Thread brulimat
Hi guys! I have a question. My IDs are GUID but a specific property is an index column. This column uses Oracle´s Sequence. My question is: How to use a Oracle`s Sequence into a property? Sorry, but I´m a newbie. Thank you. Bruno.

[nhusers] Re: Composite-element with null columns in map is ignored

2009-07-01 Thread Fabio Maulo
I don't think somebody should fix that issue (more... somebody should close it as won't fix).A component with all properties null is nothing (mean is null it self). There is another possibility... a component is always created even when all properties are null (this is not the way NH is working).

[nhusers] Re: HQL / Critera query for self referencing table and order by

2009-07-01 Thread Fabio Maulo
2009/7/1 Graham Bunce grahambu...@hotmail.com Can this do the recursive (max 3 levels) with sorting that I'm after? Only three levels ? http://nhjira.koah.net/browse/NH-1856 -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are

[nhusers] Session Cache isn't working the way I thought it did.

2009-07-01 Thread Josh Rogers
I don't know if cache is the right terminology, but it is the best I could think of. I am adding an object to a conversation by calling SessionFactory.GetCurrentSession().Save (which works), but later I need to retrieve that object but I do not know the id however I do know certain attributes of

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Fabio Maulo
Query mean always query-to-db, after the query to DB is executed the session-cache begin working returning you the existing instance in the session-cache or attaching new instance.Btw because you are talking about conversation we must know the POID strategy you are using. 2009/7/1 Josh Rogers

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Josh Rogers
Ok, but how do I get it to look at the cache first? I don't want it to query the db until it can't find the object in cache, that would seem the natural order of things. As far as the POID strategy I am using the db generated ID that increments by 1 each time a new item is added. JOsh On Wed,

[nhusers] How to run a custom SQL subquery?

2009-07-01 Thread Dietrich
I've got a search function in my program that is able to build a sql statement, which, when ran, will return a list of ID's (integers). I want to fetch (with paging) records from a table where the ID is on this list. What is the best way to do this? It seems like it would be nice and easy if

[nhusers] maybe slow performance

2009-07-01 Thread Jan Limpens
Hello, first of all - my doubt stems from the usage of nhprof and it's Duration feature. I am not sure how much I can trust it, due to it's beta stage. When profiling my application, depending on their complexity the queries shown in the profiler all have a duration from ~130ms to ~460ms, which

[nhusers] Re: How to run a custom SQL subquery?

2009-07-01 Thread Tuna Toksoz
You may want to implement your own Projection and use it with Restrictions.In( ) thing. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 1, 2009 at 10:54 PM, Dietrich

[nhusers] Re: maybe slow performance

2009-07-01 Thread Tuna Toksoz
Have you tried recent nhprof bit? Ayende has integrated this duration reporting into NH Core http://ayende.com/Blog/archive/2009/06/28/nh-prof-query-duration.aspx Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Fabio Maulo
2009/7/1 Josh Rogers joshlrog...@gmail.com As far as the POID strategy I am using the db generated ID that increments by 1 each time a new item is added. If you mean identity you must know how identity work. Identity break the UnitOfWork pattern and session.Save mean a INSERT to DB. If you

[nhusers] Re: maybe slow performance

2009-07-01 Thread Jan Limpens
yip, that's the newest available build. 2009/7/1 Tuna Toksoz tehl...@gmail.com Have you tried recent nhprof bit? Ayende has integrated this duration reporting into NH Core http://ayende.com/Blog/archive/2009/06/28/nh-prof-query-duration.aspx Tuna Toksöz Eternal sunshine of the open

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Josh Rogers
Ok, well I have spent the last 4 weeks trying to bend my application to work with NHibernate and I can't lose anymore productivity so I am going to have to pull out NHibernate and go back to dealing with ADO directly or find another ORM solution. I just wanted to thank everyone for their time, it

[nhusers] Re: HQL / Critera query for self referencing table and order by

2009-07-01 Thread Tuna Toksoz
that user wanted to cascade infinitely many levels of children. it was a bit off topic, i believe. 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, Jul 2, 2009 at 1:44 AM, Graham Bunce

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Fabio Maulo
2009/7/1 Graham Bunce grahambu...@hotmail.com And to explain your issue, NH always goes to the DB for a query. I suspect this is for performance reasons as how can it search its cache on any number of unknown (by the NH designer) parameters that a developer will provide? It would just be too

[nhusers] Re: HQL / Critera query for self referencing table and order by

2009-07-01 Thread Fabio Maulo
2009/7/1 Graham Bunce grahambu...@hotmail.com Sorry Fabio, what that JIRA link meant to help me? ;) Was a joke. Apparently the limits of sub-levels is 450. -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Graham Bunce
You can even explain the logic to NH using natural-id ;) Sheesh, I've just about got my head around NH 2.0.1GA without getting my head around all the new 2.1.0 features!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread Fabio Maulo
2009/7/1 Graham Bunce grahambu...@hotmail.com You can even explain the logic to NH using natural-id ;) Sheesh, I've just about got my head around NH 2.0.1GA without getting my head around all the new 2.1.0 features!! Stay updated... stay updated the world of Open Source is going fast. ;)

[nhusers] Propery Formula

2009-07-01 Thread Pete
Does anyone know if mapping a property to a stored procedure should work? id name=MyId type=Guid generator class=assigned/ /id property name=MyProperty access=nosetter.camelcase formula=( EXEC MyStoredProc MyId ) / The generated SQL is something like: SELECT this_.MyId as

[nhusers] Interception the sql

2009-07-01 Thread Bruno Lima
Hello. Is there way to intercepting the sql that is sending to data base? I want to do like the EmptyInterceptor does with the Entities. Sorry, but I´m a newbie. Thank you. Bruno. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[nhusers] Re: Paging error: The column xxx was specified multiple times for query

2009-07-01 Thread Dave
SOLVED: I fixed my own issue the problem was I had different case in my HBM file to a property upper-case in the property but lower case when it was used in a relationship On Jul 1, 4:30 pm, Dave dave.els...@gmail.com wrote: I have made a Generic class that adds paging and criteria. When I

[nhusers] Re: Property with Oracle´s sequence?

2009-07-01 Thread mhanney
You could map it as an int and set the value explicitly using a sql query. property = (int)session.CreateSQLQuery(SELECT YOUR_SEQUENCE.NEXTVAL FROM DUAL).AddScalar(NEXTVAL, NHibernateUtil.Int32).UniqueResult ()); .. and be sure to use transactions. If you don't want Oracle specific SQL in

[nhusers] Re: Property with Oracle´s sequence?

2009-07-01 Thread Bruno Lima
Thank you Michael for help me. It´s works fine! Better if exists a automatic way to do that on mapping my property. :) About the index column, is only for sorting asc or dec, but respecting the sequence returned values. Thank you again. Bruno. 2009/7/1 mhanney mrh5...@gmail.com You could

[nhusers] Re: Propery Formula

2009-07-01 Thread Fabio Maulo
2009/7/1 Pete peter.w.da...@gmail.com I am trying to create a boolean readonly property that is populated by a IF EXISTS (SELECT ... ) query to see if there are rows related to this table in another table. Don't say it to your DBA, preserve his health (an infarct is the minimum when he will

[nhusers] Re: Propery Formula

2009-07-01 Thread Fabio Maulo
A SP in a formula really is something very new for me.Btw in NH2.0.1 you must register the KeyWord 'EXEC' in your dialect. in NH2.1.0 the keyword should be there. 2009/7/1 Pete peter.w.da...@gmail.com Does anyone know if mapping a property to a stored procedure should work? id name=MyId

[nhusers] Re: Interception the sql

2009-07-01 Thread Fabio Maulo
What? 2009/7/1 Bruno Lima bruli...@gmail.com Hello. Is there way to intercepting the sql that is sending to data base? I want to do like the EmptyInterceptor does with the Entities. Sorry, but I´m a newbie. Thank you. Bruno. -- Fabio Maulo

[nhusers] Re: Interception the sql

2009-07-01 Thread Fabio Maulo
Sorry Bruno.Try to explain what you need without talk about the solution that you think had found. 2009/7/2 Fabio Maulo fabioma...@gmail.com What? 2009/7/1 Bruno Lima bruli...@gmail.com Hello. Is there way to intercepting the sql that is sending to data base? I want to do like the

[nhusers] Re: Interception the sql

2009-07-01 Thread Dario Quintana
You can use Log4net to see what SQL is sent to the DB http://www.davesquared.net/2008/01/viewing-sql-generated-by-nhibernate.html On Wed, Jul 1, 2009 at 9:39 PM, Bruno Lima bruli...@gmail.com wrote: Hello. Is there way to intercepting the sql that is sending to data base? I want to do like

[nhusers] Re: Session Cache isn't working the way I thought it did.

2009-07-01 Thread jobsamuel
I thought that since you are using db generated identity, your save would result in a db call and your further call to criteria query would work. Even if you are not using db generated id the session would automatically flush upon a query and your criteria query should still work. I think this is