[nhusers] Re: Future and caching.

2010-05-18 Thread graphicsxp
up. no one has an idea regarding this ? On 12 mai, 22:48, graphicsxp graphic...@googlemail.com wrote: Hi, I'm trying to use the Future() method and it works fine except I don't know how to take advantage of caching with it :       var countArt = criteriaCount.SetCacheable(true

[nhusers] Re: Future and caching.

2010-05-18 Thread graphicsxp
-- From: graphicsxp graphic...@googlemail.com Sent: Tuesday, May 18, 2010 5:02 PM To: nhusers nhusers@googlegroups.com Subject: [nhusers] Re: Future and caching. up. no one has an idea regarding this ? On 12 mai, 22:48, graphicsxp graphic

[nhusers] Future and caching.

2010-05-12 Thread graphicsxp
Hi, I'm trying to use the Future() method and it works fine except I don't know how to take advantage of caching with it : var countArt = criteriaCount.SetCacheable(true).SetProjection( Projections.Count(Projections.Id())).FutureValueInt32(); var results =

[nhusers] Re: What does NH in the background ?

2010-05-11 Thread graphicsxp
is mitigated by NH generating parameterized SQL queries. In this manner, much of the performance benefit of sprocs is also achieved by NH and this is (my guess) the origin of the statement to which you are referring. -Steve B. On May 10, 11:24 am, graphicsxp graphic...@googlemail.com wrote: Hi

[nhusers] Re: What does NH in the background ?

2010-05-11 Thread graphicsxp
@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of graphicsxp Sent: den 11 maj 2010 09:07 To: nhusers Subject: [nhusers] Re: What does NH in the background ? A colleague of mine told me that he once used the SQL Server profiler to see what SQL was generated by NH. He saw

[nhusers] Re: NHibernate and .Net 4.0

2010-05-10 Thread graphicsxp
Hey Michael, I was wondering if you had made progress on this ? Did you manage to get your project working with .net 4 ? Ta On 5 mai, 08:34, graphicsxp graphic...@googlemail.com wrote: Good to hear I'm not the only one having this issue I've tried to upgrade NH to .net, but I've given up

[nhusers] Re: NHibernate and .Net 4.0

2010-05-05 Thread graphicsxp
=generate_statisticstrue/property     /session-factory   /hibernate-configuration On Apr 29, 2:58 pm, graphicsxp graphic...@googlemail.com wrote: A little bit more information : If I test my DataAccess Layer project using Unit Tests instead of my website, then I get this exception

[nhusers] Re: NHibernate and .Net 4.0

2010-04-29 Thread graphicsxp
, 2010 at 4:10 AM, graphicsxp graphic...@googlemail.com wrote: Hi, I've upgraded my .net 3.5 project to .net 4.0. All is fine at compile time but I get a runtime exception when calling _sessionFactory.GetCurrentSession().BeginTransaction(). {Exception of type

[nhusers] Re: NHibernate and .Net 4.0

2010-04-29 Thread graphicsxp
framework is not set to .NET 4 Client Profile, if it is try changing it to .NET 4. I got this error when upgrading a project. Gabriel. On Apr 29, 7:19 am, graphicsxp graphic...@googlemail.com wrote: Humm...yes, you are right, this error message is obsolete. My website is in .net 4.0

[nhusers] Re: NHibernate and .Net 4.0

2010-04-29 Thread graphicsxp
 am, graphicsxp graphic...@googlemail.com wrote: Humm...yes, you are right, this error message is obsolete. My website is in .net 4.0, but my DAL project is still in .net 3.5 because I didn't want to fix all the errors related to the new ISet interface being ambitious with the IESI

[nhusers] NHibernate and .Net 4.0

2010-04-28 Thread graphicsxp
Hi, I've upgraded my .net 3.5 project to .net 4.0. All is fine at compile time but I get a runtime exception when calling _sessionFactory.GetCurrentSession().BeginTransaction(). {Exception of type 'System.ExecutionEngineException' was thrown.} There is no other information. No stack, no inner

[nhusers] Re: Issue with a subquery (possible bug in NH ?)

2010-02-04 Thread graphicsxp
or you have disabled the autoimport of keywords. You can inherit from the dialect and add the keyword TOP. 2010/1/30 graphicsxp graphic...@googlemail.com Anyone ? I've very puzzled regarding the 'this_' part of the query generated by NH... On 27 jan, 16:04, graphicsxp graphic

[nhusers] Re: Issue with a subquery (possible bug in NH ?)

2010-01-30 Thread graphicsxp
Anyone ? I've very puzzled regarding the 'this_' part of the query generated by NH... On 27 jan, 16:04, graphicsxp graphic...@googlemail.com wrote: Hi, I'm doing a subquery using a formula in one of my properties, which results in an exception : Incorrect syntax near the keyword 'TOP

[nhusers] Issue with a subquery (possible bug in NH ?)

2010-01-27 Thread graphicsxp
Hi, I'm doing a subquery using a formula in one of my properties, which results in an exception : Incorrect syntax near the keyword 'TOP'. The diagram between my tables looks like this: http://buzzmyart.s3.amazonaws.com/diag.jpg Note that the SQL generated by NH is not correct because it

[nhusers] Re: Help required for writing a query with NH criteria API

2010-01-24 Thread graphicsxp
-tables id to the parent-table's id On Jan 22, 12:28 pm, graphicsxp graphic...@googlemail.com wrote: Going the formula road seems to be the right thing to do. However, I can't figure out how to do it. I'm almost there but not quite. Here's my formula : hibernate-mapping xmlns=urn:nhibernate

[nhusers] Help required for writing a query with NH criteria API

2010-01-22 Thread graphicsxp
Hi, I need to write with the NH criteria API, the equivalent of this SQL query : SELECT DISTINCT dbo.BuzzGallery.Name, AVG(dbo.BuzzUserArt.Rating) AS EXPR1, dbo.BuzzGallery.Scrapped, dbo.BuzzGallery.DateCreated FROM dbo.BuzzGallery INNER JOIN dbo.BuzzGalleryArt ON

[nhusers] Re: Help required for writing a query with NH criteria API

2010-01-22 Thread graphicsxp
, 5:59 am, graphicsxp graphic...@googlemail.com wrote: Hi, I need to write with the NH criteria API, the equivalent of this SQL query : SELECT DISTINCT dbo.BuzzGallery.Name, AVG(dbo.BuzzUserArt.Rating) AS EXPR1, dbo.BuzzGallery.Scrapped, dbo.BuzzGallery.DateCreated FROM

[nhusers] Re: Help required for writing a query with NH criteria API

2010-01-22 Thread graphicsxp
of the time you can map a property/ filed of BuzzGallery to a formula. the formula can be defined a as a subquery to calculate the average.  this formula would be executed every time you fetch the entity from the database. why do you want to combine the two? On Jan 22, 9:20 am, graphicsxp graphic

[nhusers] how to instantiate an ISet ?

2009-11-24 Thread graphicsxp
Hi, One of my mapped classes has an ISet collection. When I create a new instance of that class, I can't add any elements to the the collection because it's null. However the compiler doesn't let me instantiate the collection. How can I do that ? Thanks -- You received this message because you

[nhusers] Re: how to instantiate an ISet ?

2009-11-24 Thread graphicsxp
Thanks !! I was doing : items = new Set(); On 24 nov, 14:40, Germán Schuager gschua...@gmail.com wrote: private ISet items = new HashedSet()   ? On Tue, Nov 24, 2009 at 10:37 AM, graphicsxp graphic...@googlemail.comwrote: Hi, One of my mapped classes has an ISet collection. When I

[nhusers] specific criteria expression across all queries

2009-10-21 Thread graphicsxp
Hi, Maybe what I'm going to ask doesn't make much sense but I'll ask anyway ;) I have a field 'scrapped' in my table which is set to true when the user delete an entity. So instead of doind a DELETE, I do an UPDATE. This way no records get deleted. However when I do a SELECT I need to make

[nhusers] Re: specific criteria expression across all queries

2009-10-21 Thread graphicsxp
this helps, -Steve B. On Oct 21, 7:23 am, graphicsxp graphic...@googlemail.com wrote: Hi, Maybe what I'm going to ask doesn't make much sense but I'll ask anyway ;) I have a field 'scrapped' in my table which is set to true when the user delete an entity. So instead of doind a DELETE, I

[nhusers] clearing the cache

2009-10-20 Thread graphicsxp
Hi, I'm getting a collection of entities from the database and bind it to a grid. These entities are cached for 10 minutes. With a different session, I delete an entity, which was in this collection. Next time I bind the grid to the collection I get an exception because one of the entities no

[nhusers] issue when using distinct in join query

2009-10-14 Thread graphicsxp
Hi, The following does not work : ICriteria criteria = SessionManager.GetCurrentSession().CreateCriteria (typeof(BuzzUserArt)); criteria.SetCacheable(true).CreateAlias(Owner, owner).Add (Expression.Like(owner.FullName, suggest, MatchMode.Anywhere).IgnoreCase()); criteria.SetProjection(

[nhusers] caching issue with Eval

2009-10-13 Thread graphicsxp
Hi, I'm binding a DataList control in ASP.net to an IList of Video entities returned by a NH query. The DataList is paginated and if I move from one page to the other, NH gets the data from the 2nd level cache because I've cached the query. The entities in my IList look like this : Video {Id,

[nhusers] Re: caching issue with Eval

2009-10-13 Thread graphicsxp
of the cached query ? 2009/10/13 graphicsxp graphic...@googlemail.com Hi, I'm binding a DataList control in ASP.net to an IList of Video entities returned by a NH query. The DataList is paginated and if I move from one page to the other, NH gets the data from the 2nd level cache

[nhusers] Re: caching issue with Eval

2009-10-13 Thread graphicsxp
of the cached query ? 2009/10/13 graphicsxp graphic...@googlemail.com Hi, I'm binding a DataList control in ASP.net to an IList of Video entities returned by a NH query. The DataList is paginated and if I move from one page to the other, NH gets the data from the 2nd level cache

[nhusers] Re: caching issue with Eval

2009-10-13 Thread graphicsxp
of the cached query ? 2009/10/13 graphicsxp graphic...@googlemail.com Hi, I'm binding a DataList control in ASP.net to an IList of Video entities returned by a NH query. The DataList is paginated and if I move from one page to the other, NH gets the data from the 2nd level cache

[nhusers] Re: caching issue with Eval

2009-10-13 Thread graphicsxp
sorry, I have no idea why my message was posted 3 times ! On 13 oct, 19:24, graphicsxp graphic...@googlemail.com wrote: AFAIY it is part of the cached query. If I debug it and look at the Owner property, it is not proxied.  Plus, I did a quick test by retrieving the Owner property in the code

[nhusers] request for help with mapping

2009-10-07 Thread graphicsxp
Hi, I'm half-way through my mapping and i'm facing a problem. Here are my tables: [User]{UserId} [Video]{VideoId} [RatedVideo]{UserId, VideoId, Rate} I've done the mapping for user and video. In the User's mapping there is a Set of Video entities. Now how should I do it for RatedVideo ?

[nhusers] Re: nhibernate deletes all my record before inserting

2009-10-06 Thread graphicsxp
: nhusers@googlegroups.com [nhus...@googlegroups.com] f#246;r graphicsxp [graphic...@googlemail.com] Skickat: den 5 oktober 2009 17:14 Till: nhusers Ämne: [nhusers] nhibernate deletes all my record before inserting Hi, I have an entity which holds a collection of other entites

[nhusers] nhibernate deletes all my record before inserting

2009-10-05 Thread graphicsxp
Hi, I have an entity which holds a collection of other entites. In the database this tranlates to 3 tables. [BuzzUser] {BuzzUserID, Name} [BuzzUserArt] {BuzzUserArtID, Title} [BuzzUserFavourites]{BuzzUserFavouritesID, BuzzUserID, BuzzUserArtID} In the mapping of BuzzUser, I've mapped the

[nhusers] Re: issue with inverse=true

2009-09-09 Thread graphicsxp
Thanks for the tips ! :) On 9 Sep, 14:55, Fabio Maulo fabioma...@gmail.com wrote: Remove even the column attribute (same name of property is the default).About the not-null what I mean is that you don't need it because and int32 can't be null so... ORM ;) 2009/9/9 graphicsxp graphic

[nhusers] Re: issue with inverse=true

2009-09-08 Thread graphicsxp
in System.Web.Security. So the value I'm trying to persist is MembershipPasswordFormat.Clear, which is equal to 0. For some reason, NH does an update even when the value is not changed. Anyone ? On 24 Aug, 16:13, graphicsxp graphic...@googlemail.com wrote: Hi, Thanks for helping. The mapping for the Art

[nhusers] Re: issue with inverse=true

2009-08-24 Thread graphicsxp
to understand the problem with the parts of mappings you wrote before. And also please check generated SQL queries, probably you'll find the answer yourself. On Aug 22, 10:08 pm, graphicsxp graphic...@googlemail.com wrote: Hi, I'll post the relevant part of my mapping. I have two classes : Art

[nhusers] issue with inverse=true

2009-08-22 Thread graphicsxp
Hi, I'll post the relevant part of my mapping. I have two classes : Art and Artist. An Artist owns a collection of Art and an Art belongs to one and only one Artist. Art mapping : class name=xxx table=xxx id name=Id column=xxx type=guid generator class=guid.comb/ /id

[nhusers] [asp.net] Using multiple SessionFactory in a single request

2009-08-12 Thread graphicsxp
Hi, I've defined two hibernate-configuration, one in my web.config and one in hibernate.cfg.xml. The one in hibernate.cfg.xml is used to create a SessionFactory in the ApplicationStartup event. It's the one I use throughout my application and everyting's fine. I've started to use the ASP.net

[nhusers] Re: [asp.net] Using multiple SessionFactory in a single request

2009-08-12 Thread graphicsxp
files assembly in the code and only once. It's running all fine now. What do you mean by 'That code should be modified' ? Could you explain a little bit more please. On 12 août, 22:26, Fabio Maulo fabioma...@gmail.com wrote: That code should be modified. 2009/8/12 graphicsxp graphic

[nhusers] issue with my mapping

2009-07-16 Thread graphicsxp
Hi, I can't figure out how to do my mapping. I have 3 tables : Person {PersonID, Name} Analyst{AnalystID, PersonID, Role} PersonAnalyst{PersonID, AnalystID} In my business model an Analyst inherits from Person. And a Person can holds a collection of Analysts. I've managed to map Person and

[nhusers] Re: issue with my mapping

2009-07-16 Thread graphicsxp
work as both. The inheritance express different type of thing and not different roles ;) 2009/7/16 graphicsxp graphic...@googlemail.com Hi, I can't figure out how to do my mapping. I have 3 tables : Person {PersonID, Name} Analyst{AnalystID, PersonID, Role} PersonAnalyst

[nhusers] Re: Mapping enums in NHibernate

2009-05-21 Thread graphicsxp
, graphicsxp graphic...@googlemail.comwrote: What is wrong with my mapping ? I have imported a reference to NHibernate in my project and the EnumStringType exists. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers

[nhusers] Help with an unsaved transient instance issue

2009-05-14 Thread graphicsxp
Hi, I'm having the following exception when I try to save my Post entity : object references an unsaved transient instance - save the transient instance before flushing: Metrica.SimplePerson I save my Post entity by using .Merge(). The property in Post which refers to SimplePerson is mapped

[nhusers] Re: Help with an unsaved transient instance issue

2009-05-14 Thread graphicsxp
I've figured it out I had a many-to-one in Post which target entity had a reference to SimplePerson, and that property was not set to cascade=merge. On 14 May, 17:24, graphicsxp graphic...@googlemail.com wrote: Hi, I'm having the following exception when I try to save my Post entity

[nhusers] Re: Help with aggregation

2009-05-13 Thread graphicsxp
() to UniqueResultint () here is the difference between count and distinct count Sample Data: ID 1 1 2 3 4 4 4 Count() will return 7 (1, 1, 2, 3, 4, 4, 4) DistinctCount() will return 4 (1, 2, 3, 4) On May 13, 5:01 am, graphicsxp graphic...@googlemail.com wrote: Thanks zoid, I actually had

[nhusers] Re: Help with aggregation

2009-05-13 Thread graphicsxp
(Projections.Count(Posts)) // or .Add (Projections.Count(Projections.Property(Posts))) ) .SetMaxResults(100) .SetResultTransformer([can't remember the exact transformer]) .ListSourceWithPostCount(); On May 13, 9:20 am, graphicsxp graphic...@googlemail.com wrote: Thanks for clarifying that !  The .List

[nhusers] using loader in the mapping

2009-05-13 Thread graphicsxp
Hello, I just saw in the doc that it's possible to use a stored procedure to load an entity by doing that in the mapping : class name=Person id name=Id generator class=increment/ /id property name=Name not-null=true/ loader query-ref=person/ /class That's pretty cool,

[nhusers] Re: generating value on update in the mapping

2009-05-13 Thread graphicsxp
) in SessionManager.cs: line 85 at Metrica.Data.Tests.SourceDaoTests.SetUp() in SourceDaoTests.cs: line 24 On 23 avr, 18:51, Fabio Maulo fabioma...@gmail.com wrote: version 2009/4/23 graphicsxp graphic...@googlemail.com Hi, I have a property DateModified on my entity which map to a date field in my

[nhusers] Help with aggregation

2009-05-12 Thread graphicsxp
Hello, I'd like to get some help with a HQL syntax. Here are my classes : class Post { Source theSource ; } class Source { IListPost Posts; } In the mapping of Source I have : bag name=Posts lazy=true key column=SourceID / one-to-many class=Post/ /bag and in the mapping of

[nhusers] Re: not-found = ignore triggers loading

2009-05-01 Thread graphicsxp
) on their bug report platform. So I thought it was a bug rather than a normal behaviour. But your explanation makes sense. On 1 mai, 00:42, Fabio Maulo fabioma...@gmail.com wrote: 2009/4/30 graphicsxp graphic...@googlemail.com I had no reply to this ? This looks like a pretty big issue

[nhusers] Re: hibernate is doing too many SELECT

2009-05-01 Thread graphicsxp
30, 2009 at 5:32 PM, graphicsxp graphic...@googlemail.comwrote: Hi, This is driving me crazy. NH does 3 Selects instead of doing a simple inner join to get my entity and the associated entities ! I have no idea why class Post {  Source theSource; } class Source

[nhusers] Re: hibernate is doing too many SELECT

2009-05-01 Thread graphicsxp
(thePublication, P) .SetFetchMode(P.theCountry, FetchMode.Eager) .UniqueResultPost(); I which case should I use FetchMode.Eager then ? Thanks a lot for the help ! On 1 mai, 10:48, graphicsxp graphic...@googlemail.com wrote: Hello, Thanks !  I've never used CreateAlias before. So I

[nhusers] Re: Issue with eager fetching

2009-04-30 Thread graphicsxp
No one knows about this ? It's a big issue, especially if I try to return a list of entities rather than just one. In this case the second select is executed for every entity, leading to hundreds of selects instead of one ! On 29 avr, 13:54, graphicsxp graphic...@googlemail.com wrote: Hi, I

[nhusers] hibernate is doing too many SELECT

2009-04-30 Thread graphicsxp
Hi, This is driving me crazy. NH does 3 Selects instead of doing a simple inner join to get my entity and the associated entities ! I have no idea why class Post { Source theSource; } class Source { Region theRegion; Language theLanguage; } class Region{} class Language{} When I do :

[nhusers] merge and fetch=join

2009-04-30 Thread graphicsxp
Hi, I carry on with my series of posts about fetching strategy issues class Post { Publication thePublication } class Publication { Region theRegion } class Region { } if I set the fetch policy of the many-to-one property in Publication mapping : many-to-one fetch=join

[nhusers] Re: merge and fetch=join

2009-04-30 Thread graphicsxp
fabioma...@gmail.com wrote: cascade=merge 2009/4/30 graphicsxp graphic...@googlemail.com Hi, I carry on with my series of posts about fetching strategy issues class Post {  Publication thePublication } class Publication {  Region theRegion } class Region

[nhusers] Re: merge and fetch=join

2009-04-30 Thread graphicsxp
, Fabio Maulo fabioma...@gmail.com wrote: From your mail:this returns a Post entity with a join on Publication BUT not on Region 2009/4/30 graphicsxp graphic...@googlemail.com Do you mean on the theSource property of my Post class ? If so, here's what it looks like at the moment :  many

[nhusers] inheritance issue

2009-04-29 Thread graphicsxp
Hi, I have an issue due to some poorly design database (which I can't change now). I want to have 3 classes : Person , Employee which inherits from Person Analyst which inherits from Person as well. In the database there are 3 tables : [Person] {PersonId, Fullname} [Employee] {EmployeeId,

[nhusers] Re: inheritance issue

2009-04-29 Thread graphicsxp
hum I think join-subclass is the answer to my problem.. correct me if I'm wrong. On 29 avr, 11:41, graphicsxp graphic...@googlemail.com wrote: Hi, I have an issue due to some poorly design database (which I can't change now). I want to have 3 classes : Person , Employee which inherits

[nhusers] executing stored procedure

2009-04-29 Thread graphicsxp
Hi, I have a named query which is supposed to execute a stored procedure : sql-query name=ConvertSource exec sp_GENERIC_ConvertPublication :@PublicationID, :@Type /sql-query Here is the stored procedure code : DECLARE @OldType AS INT SELECT @OldType = BroadMediaTypeID FROM

[nhusers] Issue with eager fetching

2009-04-29 Thread graphicsxp
Hi, I have 3 tables : [Post] and [Region] are in sqlserver database called Media. [User] is in sqlserver database called Admin. Region and User both have foreign keys to Post. So when I get a Post record I'm expecting NH to join on Region and Post when I do eager- fetching : return

[nhusers] Re: executing stored procedure

2009-04-29 Thread graphicsxp
/4/29 graphicsxp graphic...@googlemail.com Hi, I have a named query which is supposed to execute a stored procedure :  sql-query name=ConvertSource    exec sp_GENERIC_ConvertPublication :@PublicationID, :@Type  /sql-query Here is the stored procedure code : DECLARE @OldType

[nhusers] not-found = ignore triggers loading

2009-04-29 Thread graphicsxp
Hi, If not-found property of many-to-one mapping is set to ignore, the association always gets eagerly initialized regardless of the value of the lazy property. Is this meant to happen ? Thanks --~--~-~--~~~---~--~~ You received this message because you are

[nhusers] Re: error with current_session_context_class

2009-04-28 Thread graphicsxp
: Correct!! and I hope you are using manual Bind Unbind in your webModule, right ? 2009/4/24 graphicsxp graphic...@googlemail.com Hi, I'm trying to integrate nhibernate with asp.net.  I want to create and open the session on the Begin_Request event in the global.asax file. It works

[nhusers] Re: question about components

2009-04-24 Thread graphicsxp
Yes you are right. that was a bit silly of me ! On 23 Apr, 18:50, Fabio Maulo fabioma...@gmail.com wrote: 2009/4/23 graphicsxp graphic...@googlemail.com One other thing actually.  Is there any way of telling hibernate to lazy-load a component ? Say in the example above, I don't need

[nhusers] converting sub-classes

2009-04-24 Thread graphicsxp
Hi, I have a bit of a weird case when I have 2 classes A and B inheriting from C, and I should be able to convert an object of type A to type B (and the other way around too). These 2 classes are mapped as sub-class in the mapping using a discriminator. Will hibernate be able to persist the

[nhusers] error with current_session_context_class

2009-04-24 Thread graphicsxp
Hi, I'm trying to integrate nhibernate with asp.net. I want to create and open the session on the Begin_Request event in the global.asax file. It works if I set the current_session_context_class to 'managed_web'. However If I set it to 'web', then I get the error No session bound to the

[nhusers] question about components

2009-04-23 Thread graphicsxp
Hi, I was looking at the tutorial about components on the blog... In the following example : class name=Person table=People id name=Id generator class=identity/ /id property name=Name / component name=Address property

[nhusers] Re: question about components

2009-04-23 Thread graphicsxp
to a given person... it is a value object. * Does component replaces this ? yes On Thu, Apr 23, 2009 at 10:33 AM, graphicsxp graphic...@googlemail.comwrote: Hi, I was looking at the tutorial about components on the blog...  In the following example : class name=Person        table

[nhusers] generating value on update in the mapping

2009-04-23 Thread graphicsxp
Hi, I have a property DateModified on my entity which map to a date field in my database table. I'd like this field to be updated with the current date whenever an update is perform on the table. Is it possible to do that directly in the mapping file ? If so, what the syntax for that ? Thanks

[nhusers] Re: generating value on update in the mapping

2009-04-23 Thread graphicsxp
 am, graphicsxp graphic...@googlemail.com wrote: Hi, I have a property DateModified on my entity which map to a date field in my database table. I'd like this field to be updated with the current date whenever an update is perform on the table. Is it possible to do that directly

[nhusers] Re: question about components

2009-04-23 Thread graphicsxp
One other thing actually. Is there any way of telling hibernate to lazy-load a component ? Say in the example above, I don't need the Address to be loaded until I do myEntity.theAddress() is that possible ? On 23 Apr, 15:11, graphicsxp graphic...@googlemail.com wrote: Thanks. It makes

[nhusers] No CurrentSessionContext configured (set the property current_session_context_class)

2009-04-21 Thread graphicsxp
I'm getting this exception: No CurrentSessionContext configured (set the property current_session_context_class) when doing : mySessionFactory.GetCurrentSession(); In my hibernate.cfg.xml I've added the property : property name=current_session_context_classthread/property But I still get

[nhusers] Re: No CurrentSessionContext configured (set the property current_session_context_class)

2009-04-21 Thread graphicsxp
Basically I'm trying to share the same session across all my DAO's by using GetCurrentSession of the SessionFactory object. It's a console application, so what should I do to get this to work ?? On 21 Apr, 13:40, graphicsxp graphic...@googlemail.com wrote: ha yes sorry, I got that from

[nhusers] Re: No CurrentSessionContext configured (set the property current_session_context_class)

2009-04-21 Thread graphicsxp
, Apr 21, 2009 at 3:55 PM, graphicsxp graphic...@googlemail.comwrote: Basically I'm trying to share the same session across all my DAO's by using GetCurrentSession of the SessionFactory object. It's a console application, so what should I do to get this to work ?? On 21 Apr, 13:40

[nhusers] Re: No CurrentSessionContext configured (set the property current_session_context_class)

2009-04-21 Thread graphicsxp
? On 21 Apr, 14:35, graphicsxp graphic...@googlemail.com wrote: What do I use to open the downloaded file ? There's no file extension... Anyway, I thought NH would provide the necessary context to share my session across dao's, am I wrong ? On 21 Apr, 14:09, Gustavo Ringel gustavo.rin

[nhusers] Re: No CurrentSessionContext configured (set the property current_session_context_class)

2009-04-21 Thread graphicsxp
. Is it still ok to use this context class ? Thanks On 21 Apr, 14:43, graphicsxp graphic...@googlemail.com wrote: Ha actually I've changed  my property to : property name=current_session_context_classthread_static/ property Now I get a different error : No session bound to the current context I

[nhusers] question about join tables

2009-04-20 Thread graphicsxp
Hi, I've read this article on the blog : http://nhforge.org/blogs/nhibernate/archive/2009/04/20/nhibernate-mapping-lt-join-gt.aspx My question is, is it possible to do the same thing and have complex objects making up the join table ? Example : 3 tables : [Article] {article_id, content}

[nhusers] Too many INSERT's

2009-04-09 Thread graphicsxp
Hi, If I have an entity which holds a collection and I add 200 entities to that collection, when I save it generates 200 INSERT's and it doesn't batch them. I know this is because my tables have an identity field and NH needs to do a select SCOPE_IDENTITY() after each INSERT. However, since I

[nhusers] Re: Too many INSERT's

2009-04-09 Thread graphicsxp
would have solved that issue. On 9 avr, 11:53, Markus Zywitza markus.zywi...@gmail.com wrote: http://www.google.com/search?hl=deq=nhibernate+hilo+hibernate_unique... Try the first two results. -Markus 2009/4/9 graphicsxp graphic...@googlemail.com Ok, I've tried id name=Id column

[nhusers] Re: Too many INSERT's

2009-04-09 Thread graphicsxp
wrote: why not switch to primary key generation strategy HiLo? or SequenceHiLo? then you would get Id, and there would be minimal trips to database 2009/4/9 graphicsxp graphic...@googlemail.com: Hi, If I have an entity which holds a collection and I add 200 entities

[nhusers] Re: Too many INSERT's

2009-04-09 Thread graphicsxp
with the single column and NH, HiLo and MSSQL2005 will be friends. -Markus 2009/4/9 graphicsxp graphic...@googlemail.com Thanks for the links. I had already looked at all that, but it appears that there's no solutions for people using MS SQLServer + identity fields.  The help doesn't go through

[nhusers] identity field and .Merge()

2009-04-09 Thread graphicsxp
Hi, I'm really having all sort of issues with the identity field... Now I've noticed that if I use .Merge to persist my entity, NH does a SELECT Scope_Identity, however the value is not assigned to my entity's id field , why ?? If I use SaveOrUpdate, it works fine. I need to use Merge

[nhusers] Re: identity field and .Merge()

2009-04-09 Thread graphicsxp
Forget it,I've figured it out Merge returns the persisted object so I just need to assign that returned object to my entity : entityToSave = session.Merge(entityToSave) On 9 avr, 14:22, graphicsxp graphic...@googlemail.com wrote: Hi, I'm really having all sort of issues with the identity

[nhusers] Re: delete generates lots of queries

2009-04-08 Thread graphicsxp
Yes but that would delete all of the children for a given parent ! What if I only want to delete a few of them ? The IN would still be appropriate and would be : DELETE FROM TABLE_B WHERE CHILDREN_ID IN (1, 2, 3) On 8 avr, 12:02, Graham Bunce grahambu...@hotmail.com wrote: I'm a little

[nhusers] Re: NHibernate and WCF

2009-04-08 Thread graphicsxp
service.  The updating service will then load entities from the NHib session, update them and then pass resulting state changes (e.g. an Identity value has been assigned) back over the wire to the client. Cheers, John On Apr 7, 3:07 pm, graphicsxp graphic...@googlemail.com wrote: John I

[nhusers] Re: delete generates lots of queries

2009-04-07 Thread graphicsxp
...@gmail.com wrote: If what you are looking for is only one round trip you can obtain the same result configuringproperty name=adonet.batch_size100/property If you want exactly DELETE FROM TABLE_A WHERE CHILDREN_ID IN (1, 2, 3) you should add a Improvement request in our JIRA. 2009/4/6 graphicsxp

[nhusers] Re: NHibernate and WCF

2009-04-07 Thread graphicsxp
services is of interest to many people and there are very few clear best practices at the moment. On Apr 6, 2:11 pm, graphicsxp graphic...@googlemail.com wrote: Hi John I tend to agree with you, although I can see the benefits of using DTO's as well.  If go back to your first reply

[nhusers] Re: NHibernate and WCF

2009-04-07 Thread graphicsxp
, and returns the Post entity back to the client. But here's the issue, the CommentPost collection of the Post is now Metrica.CommentPost[0] which is quite odd. Is this a WCF issue ? On 7 avr, 09:43, graphicsxp graphic...@googlemail.com wrote: Yes that's for the benefits of using DTO's, but I'm more

[nhusers] Re: delete generates lots of queries

2009-04-07 Thread graphicsxp
I'll reply to myself I've used NHProfiler (really good tool : ) ) and I can see the DELETE are batched according to the value in property name=adonet.batch_size5/property I've created the JIRA request for the IN thing. Thanks to all ! On 7 avr, 09:40, graphicsxp graphic...@googlemail.com

[nhusers] Re: NHibernate and WCF

2009-04-07 Thread graphicsxp
. but even if you wanted a DTO up/down CRUD model just send back the DTO and map it back to your domain object. On Tue, Apr 7, 2009 at 4:43 AM, graphicsxp graphic...@googlemail.com wrote: Yes that's for the benefits of using DTO's, but I'm more concerned with the drawbacks :p How do I map my

[nhusers] Re: NHibernate and WCF

2009-04-06 Thread graphicsxp
loaded collections. James On Tue, Mar 31, 2009 at 12:08 PM, graphicsxp graphic...@googlemail.comwrote: Hi, I'm struggling to get WCF Service working with NHibernate. I have a  Post entity which holds a collection of Publication entities (lazy loaded). When the collection

[nhusers] delete generates lots of queries

2009-04-06 Thread graphicsxp
Hi, If I remove all the items in my collection and saves my entity to which the collection belongs, I get one DELETE query per items. How can I have all these items deleted with the same DELETE query using something like : DELETE FROM myTable WHERE id IN (1, 2, 3 , ... ) Thanks

[nhusers] Re: how to detect changes to entities

2009-04-06 Thread graphicsxp
[mailto:nhus...@googlegroups.com] On Behalf Of graphicsxp Sent: den 3 april 2009 16:09 To: nhusers Subject: [nhusers] Re: how to detect changes to entities SaveOrUpdate triggers an UPDATE regardless the entity has changed or not. I'm not sure about session.Merge. On 3 avr, 15:00, Gustavo

[nhusers] Re: delete generates lots of queries

2009-04-06 Thread graphicsxp
!) 2009/4/6 graphicsxp graphic...@googlemail.com er.. no I don't think this is the solution !  My db is well in place and it's there for over three years and I can't re-design anything at this stage. Any other suggestions ? On 6 avr, 16:45, Fabio Maulo fabioma...@gmail.com wrote: Let NH

[nhusers] Re: how to detect changes to entities

2009-04-06 Thread graphicsxp
. 2009/4/6 graphicsxp graphic...@googlemail.com Hello, I still don't get it.  Roger you gave me a link to hibernate doc, but this is nhibernate and I can't find any references to .Merge() in the nhibernate doc. Here's what I do and what I need ; Open Session Get entity

[nhusers] Re: delete generates lots of queries

2009-04-06 Thread graphicsxp
Ok, so what do you think could prevent NH from doing the DELETE *** IN (1, 2, ...) ? On 6 avr, 17:44, Fabio Maulo fabioma...@gmail.com wrote: you are seeing another movie (the on-delete=cascade is tested). 2009/4/6 graphicsxp graphic...@googlemail.com Ok, I had misunderstood

[nhusers] Re: how to detect changes to entities

2009-04-06 Thread graphicsxp
wrote: Merge 2009/4/6 graphicsxp graphic...@googlemail.com If I use Update(), NH does a UPDATE query (regardless my entity was modified or not) but doesn't persist or delete the items in the collection... On 6 avr, 17:28, Fabio Maulo fabioma...@gmail.com wrote: The method

[nhusers] Re: superfluous many-to-one update

2009-04-05 Thread graphicsxp
:48, graphicsxp graphic...@googlemail.com wrote: Hi, I'm using NHProfiler to profile my NH activity and I'm getting the warning: superfluous many-to-one update - use inverse = 'true' I have two classes, Post and Comment, here is the mapping : Post.hbm.xml : hibernate-mapping xmlns

[nhusers] Re: superfluous many-to-one update

2009-04-05 Thread graphicsxp
of a manager, you are better off with a set. On Sun, Apr 5, 2009 at 2:06 PM, graphicsxp graphic...@googlemail.comwrote: Could someone help with this issue ? I've searched online but I' m under the impression that I've done the right thing, i.e.  I put inverse=true in the bag collection .. I'm

[nhusers] Re: Using SQL Server Default value for column

2009-04-05 Thread graphicsxp
not using any database-generated values at all On Tue, Mar 31, 2009 at 5:28 PM, graphicsxp graphic...@googlemail.comwrote: right you are, otherwise my entity would not have the right value. Thanks for that. However there is no such thing as generated=true,  available values are 'never

  1   2   >