[nhusers] The Old-Value problem for audit logs

2008-11-11 Thread Stefan Steinegger
I'm struggling with the classical audit log problem. I'm using an NHibernate Interceptor to get called when anything is stored. We have a three tier architecture and the changes on the entities mostly occur outside of a session. Now I need to get the original values from the database to compare

[nhusers] Re: The Old-Value problem for audit logs

2008-11-11 Thread Stefan Steinegger
. Thanks again. On 11 Nov., 15:21, Fabio Maulo [EMAIL PROTECTED] wrote: 2008/11/11 Stefan Steinegger [EMAIL PROTECTED] Ok, I'll try Merge and hope that it does not have bigger implications. Thanks a lot guys. I'll come back if I still can't get it running. Don't forget to read Merge API doc

[nhusers] Re: The Old-Value problem for audit logs

2008-11-11 Thread Stefan Steinegger
, Ayende Rahien [EMAIL PROTECTED] wrote: Why are you trying to get the values from the DB?NH will give you the old values, and you can ensure that it will behave well with optimistic concurrency On Tue, Nov 11, 2008 at 1:04 PM, Stefan Steinegger [EMAIL PROTECTED]wrote: I'm struggling

[nhusers] Re: The Old-Value problem for audit logs

2008-11-12 Thread Stefan Steinegger
PROTECTED] wrote: 2008/11/11 Stefan Steinegger [EMAIL PROTECTED] Yes, I remember, I already used Merge for some special purpose. This could be a major issue, because we would have to use Merge as the default storing method through the whole system, by avoiding the business logic to know too

[nhusers] Re: Dealing with Id when mapping an interface

2008-11-25 Thread Stefan Steinegger
I also wonder what you mean, Fabio. By the way, we have a bit more complex case where a part of the software needs to access setters that are not available for others (e.g. setting the id / version to 0 after deep copying to create a new instance). We have another interface for this. This is a

[nhusers] Re: The Old-Value problem for audit logs

2008-11-27 Thread Stefan Steinegger
Fabio, Don't you think it is inconsistent that a Session closes a transaction it didn't start? Using ADO (or whatever) I open a connection and begin the transaction and pass it to CreateSession. When I dispose the Session, my transaction is gone. The session should distinguish if it is its own

[nhusers] Re: The Old-Value problem for audit logs

2008-11-27 Thread Stefan Steinegger
() If you would use the session factory, you would have to write sessionfactory.OpenStatelessSession(oldsession.Connection) what's really bad and shouldn't be recommended. On 27 Nov., 12:25, Fabio Maulo [EMAIL PROTECTED] wrote: 2008/11/27 Stefan Steinegger [EMAIL PROTECTED] What about

[nhusers] Re: The Old-Value problem for audit logs

2008-11-27 Thread Stefan Steinegger
or complications. What about a practical syntax like ISession.Stateless.CreateCriteria (...)? On 27 Nov., 10:48, Fabio Maulo [EMAIL PROTECTED] wrote: http://groups.google.com/group/nhibernate-development/browse_thread/t... We have some pending work about transactions. 2008/11/27 Stefan Steinegger

[nhusers] Re: The Old-Value problem for audit logs

2008-11-27 Thread Stefan Steinegger
have to change the // actual object structure to be able to store it! parentEntity.Child = dal.Merge(parentEntity.Child) dal.SaveOrUpdate(parentEntity) dal.Commit(); } On 27 Nov., 15:16, Fabio Maulo [EMAIL PROTECTED] wrote: Ok understand it need an example. 2008/11/27 Stefan Steinegger

[nhusers] Re: Advice on improving my service update method

2008-11-30 Thread Stefan Steinegger
I'm also interested in this topic. We are using a single entity domain model in our project that is mapped by NH, serves as DTO's and is also bound to the UI. It is nice to have only one model, you don't have to add data on many places (eg. mapping file, entity, DTO, mapper) which makes

[nhusers] Re: If integration tests pass on SQLite means they will always pass on MS SQL Server too?

2008-12-02 Thread Stefan Steinegger
For instance, we had issues with DateTime. SqlServer is limited in range and does not store milliseconds, while Sqlite just worked fine. On 2 Dez., 16:27, Michiel [EMAIL PROTECTED] wrote: Hello, I recently started to write integration tests for my repositories, which are implemented using

[nhusers] Re: Cascade delete from collections in multiple entities

2009-01-20 Thread Stefan Steinegger
I agree with Markus. NH should always persist what you have in memory. If you have multiple references in memory and want to remove them all at once, you need to do this in the business logic. Then you can expect from NH to do the same in the database. The business logic should always look after

[nhusers] Re: NHibernate date localization issue

2009-01-20 Thread Stefan Steinegger
I don't understand the problem. Where does NHibernate generate a date format? You should have a DateTime in the entity and a date in the database. Dates in queries should be passed as parameters, not as strings. Doesn't this work? On 19 Jan., 16:38, chris.j.smith...@googlemail.com

[nhusers] Re: Corporate sponsorship for NHibernate?

2009-01-25 Thread Stefan Steinegger
I don't use NH because it's free. I use it because it is the best way I know to access a database from a .NET application. Really, none of the products I looked at had its features or its non-intrusive nature. IMHO, many other products are only used because many oo developers don't know much

[nhusers] Re: Refresh won't work

2009-01-26 Thread Stefan Steinegger
I don't know what exactly you are doing. But it could be that NH already flushed a part of the changes to the database. If you look into the database with some DB tool, you can't see this changes, because they are not committed yet. I think, Refresh does not put the object into the cache. You

[nhusers] Re: Corporate sponsorship for NHibernate?

2009-01-26 Thread Stefan Steinegger
over his project. Rant off^^ On Sun, Jan 25, 2009 at 3:29 PM, Stefan Steinegger stefan@bluewin.chwrote: I don't use NH because it's free. I use it because it is the best way I know to access a database from a .NET application. Really, none of the products I looked at had its

[nhusers] Re: Refresh won't work

2009-01-27 Thread Stefan Steinegger
I just wrote unit tests about Refresh. I found the following: - if the object is not (yet) in the session, it works fine. - if changes are already flushed, the changes are not undone. I didn't test with evict. But I think you have a flushing problem. So don't use Refresh if you already touched

[nhusers] Re: Don't always use lazy loading!

2009-02-02 Thread Stefan Steinegger
IMO, it's always a matter of the size and complexity of the application. If you have a small desktop app, why not using NH in the UI? There aren't almost any layers. We have a client server application. Even the business logic does not reference to NH. It doesn't even reference the Data

[nhusers] Turn off lazy loading for a whole query

2009-02-05 Thread Stefan Steinegger
I have the problem that I would like to turn off lazy loading at all for certain queries. Most of our data is requested by the client (WCF), and needs to be complete. I know a can turn of lazy loading in the query. But to do this, I have to declare all the references an entity has. Many objects

[nhusers] Re: User friendly id's

2009-02-17 Thread Stefan Steinegger
I'm also interested in this. IDENTITY works for SqlServer, Oracle would need a sequence that is used in the insert statement. Is there any database independent solution? To make it a little more complicated, we are creating the database schema only from the mapping files (until now...). On 12

[nhusers] Re: User friendly id's

2009-02-17 Thread Stefan Steinegger
consecutively numbered entities (AFAIK invoices need that in some countries to fight tax evasion), I fall back to a trigger that inserts the number into a separate property. That would however require you to have additional schema definition scripts. -Markus 2009/2/17 Stefan Steinegger stefan

[nhusers] Re: cannot merge detached object

2009-03-04 Thread Stefan Steinegger
Note that Merge has a return value. The returned value is the instance in the session. This is because there could be already an instance in the session, which will be initialized with the values from your object (what actually is the merging). var attachedObject = session.Merge(detachedObject);

[nhusers] Re: : cannot merge detached object

2009-03-04 Thread Stefan Steinegger
...@gmail.com wrote: 2009/3/4 Stefan Steinegger stefan@bluewin.ch var attachedObject = session.Merge(detachedObject); Assert.IsTrue(session.Contains(attachedObject)); Don't use attachedObject anymore, it is not in the session an must not be referenced by any attached instance. I

[nhusers] Re: : cannot merge detached object

2009-03-05 Thread Stefan Steinegger
Application. Thanks for feedback antoschka On 4 Mrz., 21:41, Stefan Steinegger stefan@bluewin.ch wrote: As I know, the referenced entities in the bag are only evicted if they are mapped with cascade=all. That's the reason why I stopped using it. If I where you, I wouldn't use evict

[nhusers] Re: error after migrating from 1.2 to 2.0

2009-03-18 Thread Stefan Steinegger
You should carefully decide if you want to use lazy loading (and these proxies) by default. You could get issues with inheritance (the proxy of a subclass is not derived from the proxy of the base class) or serialization (eg. WCF). If you just want the old behaviour, you can turn off lazy loading

[nhusers] Re: Mapping Nested Collections

2009-03-18 Thread Stefan Steinegger
...@gmail.com wrote: NH2.1.0Alpha2 (actual trunk) 2009/3/18 Stefan Steinegger stefan@bluewin.ch Hi all. I'm trying to map a collection (bag) into a composite-element. Isn't this possible? class name=A ... bag name=B table=A_B  key .../  composite-element    property .../    bag

[nhusers] Re: NH2.1.0 Alpha1 is out

2009-03-19 Thread Stefan Steinegger
Thanks a lot for the ongoing incredible work! Again a stunning amount of new features and enhancements since 2.0. I'm looking forward to the final 2.1 release :-) On 19 Mrz., 05:19, Fabio Maulo fabioma...@gmail.com wrote: I don't know if you have realized that NH2.1.0Alpha1 was released... If

[nhusers] Re: NHibernate Lazy load and proxy object

2009-03-20 Thread Stefan Steinegger
Why can't you cast it because of the proxy? If the proxy would actually be derived from ProfileA, you should be able to cast it to ProfileA. Are you sure that you don't actually have a proxy of Profile? Check your mapping, did you define the subclasses and discriminators correctly? What is the

[nhusers] Re: NH2.1.0 Alpha1 is out

2009-03-20 Thread Stefan Steinegger
for it. Thanks for the hint of the waiting time. Good point. On 19 Mrz., 13:28, Fabio Maulo fabioma...@gmail.com wrote: 2009/3/19 Stefan Steinegger stefan@bluewin.ch Thanks a lot for the ongoing incredible work! Again a stunning amount of new features and enhancements since 2.0. I'm looking

[nhusers] Re: NH2.1.0 Alpha1 is out

2009-03-20 Thread Stefan Steinegger
that interalize dyn proxy On Fri, Mar 20, 2009 at 10:20 AM, Stefan Steinegger stefan@bluewin.chwrote: Fabio, I already downloaded the alpha version and tried it. There are some interface changes I have to fix, and DynamicProxy2 conflicts with the version for RhinoMocks. Nothing really

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

2009-03-25 Thread Stefan Steinegger
I have to admit that I didn't read the whole thread. When using reflection, a explicit implementation of a property has the name InterfaceNamespace.Interface.PropertyName. So you should try this in the mapping file. About the design: I also tried explicit interface implementations and removed

[nhusers] Re: TimeSpan 24h or 0h

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

[nhusers] Re: Removal of Proxy Dependencies

2009-04-02 Thread Stefan Steinegger
We are using Spring, DynamicProxy and Rhino Mocks (using Dynamic Proxy). I have to admit that I still don't have any clue which proxy system to choose. There are some problems with DP I could solve by compiling Rhino. Switching to LinFu might be even easier. But what are the actual differences of

[nhusers] Pessimistic Locking an Inheritance

2009-04-09 Thread Stefan Steinegger
We are trying to lock an instance in the database to make sure that is does not change. But only the inherited class is locked, so we are not locking the base class. pseudo code: class Base { string A { get; set; }} class Inherited { string B { get; set; }} Transaction 1: Inherited myEntity =

[nhusers] Re: Pessimistic Locking an Inheritance

2009-04-15 Thread Stefan Steinegger
nobody had the same problem? On 9 Apr., 09:49, Stefan Steinegger stefan@bluewin.ch wrote: We are trying to lock an instance in the database to make sure that is does not change. But only the inherited class is locked, so we are not locking the base class. pseudo code: class Base

[nhusers] Get Collection Snapshot in NH 2.1

2009-05-11 Thread Stefan Steinegger
Hello. I'm trying to get version 2.1 working on our codebase. I couldn't get my AuditTrail implementation working, because there are changes on NH's collections. I get the collection's old-value like in this implementation from jr76:

[nhusers] Re: Get Collection Snapshot in NH 2.1

2009-05-11 Thread Stefan Steinegger
of the collection /// /summary ICollection GetSnapshot(ICollectionPersister persister); it depend on what you are doing with it 2009/5/11 Fabio Maulo fabioma...@gmail.com IPersistentCollection.StoredSnapshot 2009/5/11 Stefan Steinegger stefan@bluewin.ch Hello. I'm trying to get

[nhusers] Re: Get Collection Snapshot in NH 2.1

2009-05-11 Thread Stefan Steinegger
] = collection.CollectionSnapshot.Snapshot; As you can see, you are casting an element of state's array to a IPersistentCollection. Obviously using collection's listeners is more easy than use IIterceptor (discontinued interface). 2009/5/11 Stefan Steinegger stefan@bluewin.ch

[nhusers] Complex user type with sql-types specified

2009-05-12 Thread Stefan Steinegger
Using NH 2.0, I have a custom type. It is composed of four properties, so I implemented ICompositeUserType. I want to specify length and precision for the string and decimal properties within the user type, to avoid specifying it with every usage in the mapping files. But there is only a

[nhusers] Re: Get Collection Snapshot in NH 2.1

2009-05-12 Thread Stefan Steinegger
there is, it needs to be structured, by NH version and topic, and needs TOC's and good navigation. If it is not structured it ends up being only a box for puzzle pieces. On 11 Mai, 21:14, Fabio Maulo fabioma...@gmail.com wrote: 2009/5/11 Stefan Steinegger stefan@bluewin.ch I know

[nhusers] How could we enhance NH's documentation?

2009-05-15 Thread Stefan Steinegger
In a thread with Fabio Maulo (http://groups.google.com.ar/group/ nhusers/browse_thread/thread/256e8a8a9958f939/ a41a81c21a26fb03#a41a81c21a26fb03) we went off on a tangent and came to the documentation problem. Here is a summary: * many things are hardly documented * the documentation is there

[nhusers] Re: How could we enhance NH's documentation?

2009-05-18 Thread Stefan Steinegger
of the hibernate documentation-reference apply to NH and which do not, or applies but with a different behavior implementation. A structure that both helps people to contribute to documentation and readers to find content easily. On Fri, May 15, 2009 at 9:56 AM, Stefan Steinegger stefan

[nhusers] Re: Implementing my own dynamic-component

2009-05-18 Thread Stefan Steinegger
There is a ICompositeUserType, where you can define several columns. You could also make it parameterized, to define in the mapping which columns exist. It depends on what problem you have actually to solve. On 18 Mai, 09:42, martin martin.kirs...@gmail.com wrote: I like the way

[nhusers] Re: How could we enhance NH's documentation?

2009-05-18 Thread Stefan Steinegger
. - More detailed explanation about session management in the Architecture. Maybe using a small example of the current best practice with contextual sessions. On Mon, May 18, 2009 at 8:30 AM, Stefan Steinegger stefan@bluewin.chwrote: Thanks, Sidar for your response

[nhusers] Re: HQL vs Criterion

2009-05-19 Thread Stefan Steinegger
This is not a trivial question at all. I still don't know many differences between hql and criteria features, and hope you get some good answers here :-) AFAIK, you don't have these pseudo-properties or functions like elements and class, and you don't have the index operator [] on lists. I do

[nhusers] Re: HQL vs Criterion

2009-05-19 Thread Stefan Steinegger
Forgot to mention: you can not make cartesian products with criteria. So you can't select columns from different tables if they don't have a mapped reference. This could be important for reports or when using legacy databases. On 19 Mai, 13:30, Stefan Steinegger stefan@bluewin.ch wrote

[nhusers] Re: HQL vs Criterion

2009-05-19 Thread Stefan Steinegger
) .SetFetchMode(BCollection, FetchMode.Join) .SetFetchMode(CCollection, FetchMode.Join) .SetFetchMode(DCollection, FetchMode.Join) .ListFoo(); -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of Stefan Steinegger Sent: den 19 maj

[nhusers] Re: Is key column=/ always a Foreign Key in the Collection table?

2009-05-26 Thread Stefan Steinegger
What else should it be? On 26 Mai, 11:25, srinivas srinivas14...@gmail.com wrote: Is  key column=/ tag  always a Foreign Key in the Collection table? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group.

[nhusers] Re: HQL Fuctions

2009-06-12 Thread Stefan Steinegger
Just bookmarked this for the documentation :-) On 11 Jun., 20:54, Fabio Maulo fabioma...@gmail.com wrote: 2009/6/11 Tuna Toksoz tehl...@gmail.com BitwiseOr BitwiseAnd and maybe DateDiff? DateAdd or similar But what is really needed is the translation in each dialect. -- Fabio Maulo

[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] 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] Re: Defining a user type for decimal with precision

2009-07-01 Thread Stefan Steinegger
wrote: There were some issues with decimal db typehttp://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

[nhusers] Re: Primary key as foreign key in NHibernate Association

2009-07-13 Thread Stefan Steinegger
Is there a reason why you don't use a many-to-many relation? I assume there are additional properties in the assignment class? You should probably use the key-many-to-one element instead of the key-property element, to tell NH that this id is actually many-to- one relation. i never used this,

[nhusers] Re: Audit table and NHibernate events

2009-07-14 Thread Stefan Steinegger
Note that you only get the old values if they have ever loaded into the session. This is important when working with detached instances. I had a hard time to figure this out and write the application that it works. - Use Get or any query to get the instance into the session and change

[nhusers] Re: NHibernate in Medium Trust

2009-07-16 Thread Stefan Steinegger
Indeed. Fabios answer might be emotional (I found it funny by the way). But Sams post is just ridiculous. Working since one and a half week with NH and demanding binaries including a certain feature pronto?? Fabio just points out what scale this project has, how many people already depend on in

[nhusers] Re: Inheritance Mapping problem Subclass

2009-07-20 Thread Stefan Steinegger
You seem to mix assembly names and namespaces: This few lines: hibernate-mapping xmlns=urn:nhibernate-mapping-2.2 namespace=toolShopCl assembly=toolShopNH class name=Person, toolShopCl After the comma, you define the assembly name. You seem to have a namespace there. It should be

[nhusers] Re: Inheritance Mapping problem Subclass

2009-07-20 Thread Stefan Steinegger
)                     transaction.Rollback();                 ExceptionShow(ex);             }             finally             {                 if (session != null)                     session.Close();             } On Jul 20, 11:15 am, Stefan Steinegger stefan.steineg...@bluewin.ch wrote

[nhusers] Re: Recovering from StaleObjectStateException

2009-07-22 Thread Stefan Steinegger
I don't know how your application looks like, and if the changes are made outside the session (detached). But - what you are doing here smells a bit. Try to treat it this way: - consider to map the class using optimistic-lock=dirty, so you only get an exception when the same properties changed.

[nhusers] Re: NHibernate updating version when the entity was not changed

2009-07-22 Thread Stefan Steinegger
If NH does unnecessary updates, it is mostly due to implicit changes within the entity. The properties must always return the exact value that has been set by NH, if it is a collection, the entity must return the same instance as set by NH, unless NH treats it as a change and updates the

[nhusers] Re: mapping

2009-08-07 Thread Stefan Steinegger
What exactly is the question? If you have a 1:M relation between two tables, you can map it differently. Lets say Table A 1=m Table B, mapped to classes A and B. - Map it as a collection (list / bag / set / map etc.) of class A - Map it as a reference (many-to-one) in class B - Map it as both,

[nhusers] Re: joins

2009-08-07 Thread Stefan Steinegger
You can use the join element to map properties which are in another table. You could have more or less classes as tables. Usually, you have more classes then tables. This is because of performance optimization. Classes could be as small as needed to make them reusable, and you will have classes

[nhusers] Re: mapping

2009-08-07 Thread Stefan Steinegger
Many but in table B I dont need objects of class A then would I still have to define Many to One there. I had tried doing that and it doesn't create any problems but just to make sure if it is mandatory. On Aug 7, 11:30 am, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: What

[nhusers] Re: Garbage collection of sessions opened in different threads

2009-08-07 Thread Stefan Steinegger
Without deep knowledge about how the sessions get garbage collection, I would not let the garbage collector clean up your session. I would let the caller make clear when he finished its stuff. For instance, make the repository disposable. The clean up all the sessions and transactions in the

[nhusers] Re: Faster loading of a lot of records to a collection (100 000 records)

2009-08-07 Thread Stefan Steinegger
You need to tell us more details about WHAT you are actually doing. Post the HQL and probably some details about the calculations. There is no general solution for 100K records. There is no If you have 100K records, just use feature X. There is some trade-off. It depends on the situation which

[nhusers] Application Hangs in Session.CreateQuery / SetParam

2009-08-07 Thread Stefan Steinegger
Currently we are doing long running tests on our system. After a couple or hours, the system suddenly hangs on a call to the NH session. I don't know if this is a NH problem, application problem or SQL server problem. Code looks like this: logger.Debug(A); session.Flush() logger.Debug(B) query

[nhusers] Re: Faster loading of a lot of records to a collection (100 000 records)

2009-08-07 Thread Stefan Steinegger
There is still not enough information to give you a meaningful advise. What kind of structure are you querying? Have you observed the sql generated by NH to say if there are many queries to load referenced objects? What amount of data do you need to make your calculation? Is it possible to load

[nhusers] Re: Join Resolution for Many-to-One Relationships

2009-08-07 Thread Stefan Steinegger
I don't think that this has any influence. But you can try this: from Product p join p.Category where p = :product ... And see what it does. On 7 Aug., 14:00, Marvin Massih marvin.mas...@googlemail.com wrote: Does nobody have an idea how to fix this? :(

[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Stefan Steinegger
I agree with Fabio. The table needs to be selected anyway. It does not make sense to only read half the columns from the table, and read the rest in another query. Usually, the most expensive are db roundtrips and joins. I think hival's mapping is what you need. You need to know what it means

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-13 Thread Stefan Steinegger
Nelson, one of NH's benefits is what is called persistence ignorance. It means that the business logic does not need to know about persistence. It just changes the state of the entities (which are attached to the session), and these changes get persisted automatically by NH. The business logic

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
much for taking some time to answer, Stefan. On Aug 13, 4:47 pm, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: Nelson, one of NH's benefits is what is called persistence ignorance. It means that the business logic does not need to know about persistence. It just changes the state

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
We found the problem, I posted a patch: http://nhjira.koah.net/browse/NH-1931 On 7 Aug., 10:15, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: Currently we are doing long running tests on our system. After a couple or hours, the system suddenly hangs on a call to the NH session. I

[nhusers] Re: Entity version update happening after Commit - not Flush?

2009-08-14 Thread Stefan Steinegger
I wouldn't build dtos after the commit, because you can't use lazy loading then. Flush should actually synchronize all the changes. So I'm also wondering ... On 13 Aug., 22:42, Luke Bakken luke.bak...@gmail.com wrote: Hello everyone, Just wanted to check that this is expected behavior in

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
Steinegger stefan.steineg...@bluewin.ch wrote: We found the problem, I posted a patch: http://nhjira.koah.net/browse/NH-1931 On 7 Aug., 10:15, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: Currently we are doing long running tests on our system. After a couple or hours

[nhusers] Re: Application Hangs in Session.CreateQuery / SetParam

2009-08-14 Thread Stefan Steinegger
, 2009 at 11:09 AM, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: I explain the problem we encountered in the issue. The patch is intended to fix it :-) I don't know how to write a sensible test for this. Of course I can create two NativeSQLQuerySpecification instances

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
Try Product product = session.LoadProduct(1); session.Delete(product); This should actually only create a proxy for the Product 8assuming you are using lazy loading). Then you can remove it. then you can use on-delete in the mapping to let the database clean up referenced records:

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
in Property should be 9 but 0. // PS: I cannot find the discription of on-delete attribute in the doc:http://nhforge.org/doc/nh/en/index.html. Blog:http://www.cnblogs.com/JeffreyZhao/ Twitter:http://twitter.com/jeffz_cn -- From: Stefan Steinegger

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
You should create new post to ask a new question. There is not actually a NH way, but a transactional way is to either commit the changes or rollback the whole thing. This is usually done by exception handling. Just an example in pseudo code: try { cat = Load(id); cat.Name = some name;

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-14 Thread Stefan Steinegger
I wouldn't evict anything. Just my opinion. There is no persistence ignorance if you can tell the persistence layer to undo some changes in memory. If you implement as if there is no persistency, you don't expect to be able to undo a few changes you made in memory. There aren't two layers of

[nhusers] Re: How can I JUST delete an entity using NHibernate

2009-08-14 Thread Stefan Steinegger
L2S. Blog:http://www.cnblogs.com/JeffreyZhao/ Twitter:http://twitter.com/jeffz_cn -- From: Stefan Steinegger stefan.steineg...@bluewin.ch Sent: Friday, August 14, 2009 7:55 PM To: nhusers nhusers@googlegroups.com Subject: [nhusers] Re: How can

[nhusers] Re: splitting big tables and entity-name feature

2009-08-14 Thread Stefan Steinegger
Why not simply: IListstring result = session .CreateQuery(select m.Text from Message where m.Read = false and ...) .Liststring(); and session.Update(Message set m.Read = false where ...); You could also have a list of ids to know which messages need to be set to read. On 14 Aug., 14:39,

[nhusers] Re: splitting big tables and entity-name feature

2009-08-17 Thread Stefan Steinegger
really worked with big tables  ? On Aug 14, 5:39 pm, ReverseBlade empe...@gmail.com wrote: If you have 50 million of records then this solution is not feasible imho, that's why I am trying to split it. On Aug 14, 4:34 pm, Stefan Steinegger stefan.steineg...@bluewin.ch wrote: Why

[nhusers] Re: Partial object queries

2009-08-17 Thread Stefan Steinegger
Isn't it easier to just load the entity model and copy the needed data to the DTO? Using lazy loading and optimized queries it should actually only load entities that are needed. I mean, development time is also not for free... On 16 Aug., 17:26, Vadimmer vadimkanto...@gmail.com wrote: The

[nhusers] Re: Collection of subclasses mapped with the subclass + join strategy

2009-08-17 Thread Stefan Steinegger
Quote: I thought that NH would see [...]. But unfortunately NH didn't. What actually did NH do? Has the foreign key been put into the wrong table? In which? On 17 Aug., 10:27, hival hi...@ukr.net wrote: Yes, exactly the same problem. The fact that I'm not the only who encountered this

[nhusers] Re: Event Listener called twice

2009-08-17 Thread Stefan Steinegger
Most probably, the pre-update is called during the flush. So NH goes through all the entities in the session and calls the trigger if they are dirty. If you change another entity there, it could have already evaluated. NH can't know that it has to be evaluated again, until you call Flush. On 17

[nhusers] Re: splitting big tables and entity-name feature

2009-08-17 Thread Stefan Steinegger
If you store references to unread messages, you don't need to read flag anymore. I know this is a special solution, it only works because you could assume that most of the messages have been read. I wouldn't use both solutions at the same time. This data partitioning stuff might also work well,

[nhusers] Re: delete child item without loading the parent.

2009-08-18 Thread Stefan Steinegger
You could probably make the friends table an own entity. Then you can load it (not loading the users because of lazy loading) and delete it. The lists in the users would be inverse, so you don't have to update them (if the are NOT in the session, unless your session will be out of synch). By

[nhusers] Re: Handling Unique constraints - exception or validation or ....???

2009-08-18 Thread Stefan Steinegger
I'm also still searching for a nice solution for this. At the moment, I stick with this: The business logic is generally responsible for data consistency. It needs to check uniqueness as well as others. Consider that there are many validations that can not be covered by the database anyway,

[nhusers] Re: sql-query

2009-08-20 Thread Stefan Steinegger
I suggest to continue this topic in the ORIGINAL thread. So please don't answer here, it would just get complicated. On 19 Aug., 21:55, mathmax maximeandrighe...@gmail.com wrote: Hello, I still have no answer in this thread.

[nhusers] Re: use an sql-query to load an entity

2009-08-20 Thread Stefan Steinegger
Where does this magneto131 come from? I is certainly not invented by NH ... On 12 Aug., 14:13, mathmax maximeandrighe...@gmail.com wrote: shipping_method as {ship.Id}inverted I don't understand. What do you mean by inverted ? It's like the example: First the field to the database, then the

[nhusers] Re: use an sql-query to load an entity

2009-08-23 Thread Stefan Steinegger
., 21:30, mathmax maximeandrighe...@gmail.com wrote: magneto131 is the name of the mysql database (set in the config file). But Nhibernate shouldn't look at a table called Shipping in this database since the entity should be loaded via the sql query. On 20 août, 08:58, Stefan Steinegger

[nhusers] Re: Can I disable automatic updating of dirty objects?

2009-08-24 Thread Stefan Steinegger
I try to explain it again. Don't rely on the fact that there is a database. Validation should not occur before changes are persisted, but when they are done (in memory, by the business logic). Making changes in memory but not storing them is NOT the solution. How would to reliably validate

[nhusers] Re: Nested Sessions/Transactions Possible ?

2009-08-24 Thread Stefan Steinegger
@Fabio, sorry, but sometimes I just don't have a clue what you are talking about :-) We are loading entities using select new or AliasToBeanResultTransformer to get instances of entities from a normal session without performance problems. You can create a child session using session.GetSession.

[nhusers] Re: Calling parent properties from inherited constructors

2009-08-24 Thread Stefan Steinegger
How does the line of code exactly look like, where the null reference exception occurs? And where is this line of code? On 24 Aug., 16:03, Seth Goldstein seth.d.goldst...@gmail.com wrote: The code is essentially: class ParentClass {   private int _myProperty;   ParentClass()   {   }  

[nhusers] Re: Map directly to readonly properties

2009-09-03 Thread Stefan Steinegger
I'm not sure if you can turn of writing to the filed. Any way, you shouldn't look for property accessors, because these are fields. On 3 Sep., 15:17, bstack bs.st...@gmail.com wrote: Can you map directly to readonly properties in NHibernate or is it impossible? e.g.    public class Entity  

[nhusers] Re: HQL Join with unmapped entities

2009-09-07 Thread Stefan Steinegger
You can just write it the old school way, by making a cartesian product and filter it in the where clause: from Parent p, Child c where p.Iid = c.FkIid On 7 Sep., 08:18, merrycoder merryco...@googlemail.com wrote: Thanks for the answer, Fabio. Unfortunately this doesn't solve my issue.

[nhusers] Re: update only some classes

2009-09-07 Thread Stefan Steinegger
There has already been a huge discussion about this here: http://groups.google.com.ar/group/nhusers/browse_thread/thread/11e5ff4c27006c4b/e4326591c21c41fa It does actually not make much sense to update only a part of your entities in memory. You should not change anything in memory you don't

[nhusers] Re: update only some classes

2009-09-07 Thread Stefan Steinegger
is taste ;)NH gives to the user the ability to apply his taste, in some case... not in all cases... but where a solution is available the user can simply apply it (obviously without ask us to apply his taste as default behaviour). 2009/9/7 Stefan Steinegger stefan.steineg...@bluewin.ch

[nhusers] Re: HQL Join with unmapped entities

2009-09-07 Thread Stefan Steinegger
Fabio: How do you define a relation in the mapping but not in the domain? By just not giving a property name? Like this? many-to-one class=Target column=FK / What can you do with it? Is is usable for criteria? I always have the problem that criteria can not make cartesian products for joins on

[nhusers] Re: Run unit tests in parallel without db deadlocks?

2009-09-07 Thread Stefan Steinegger
We are also running unit tests using SqlLite in memory. We create the database before every test (just open the connection and use Schema Export) and it is very fast. We can switch to sql server by changing the build configuration. Then it has a database for each test assembly, which is created

[nhusers] Re: Run unit tests in parallel without db deadlocks?

2009-09-08 Thread Stefan Steinegger
of this. Thanks for the replies! -Original Message- From: nhusers@googlegroups.com [mailto:nhus...@googlegroups.com] On Behalf Of Stefan Steinegger Sent: dinsdag 8 september 2009 0:03 To: nhusers Subject: [nhusers] Re: Run unit tests in parallel without db deadlocks? We are also running

  1   2   >