Re: [nhusers] Re: Map the class with subscribable collection

2009-12-08 Thread Dmitiry Nagirnyak
You can implement your own collectiontype and specify it in the mappings with attribute collection-type. Thanks. Got it. It should do the job. There is also a option to use dynamic code generators like Castle or other to dynamically implement on property changed. See

[nhusers] Re: Map the class with subscribable collection

2009-12-07 Thread Dmitiry Nagirnyak
Somebody please? Is this something that nobody knows or I don't provide enough info? 2009/12/3 Dmitiry Nagirnyak dna...@gmail.com Anybody? 2009/12/2 Dmitiry Nagirnyak dna...@gmail.com Hi, I need to map 2 classes: Blog and Post. There is an association (blog.Posts-post.BelongsTo

[nhusers] Re: Map the class with subscribable collection

2009-12-03 Thread Dmitiry Nagirnyak
Anybody? 2009/12/2 Dmitiry Nagirnyak dna...@gmail.com Hi, I need to map 2 classes: Blog and Post. There is an association (blog.Posts-post.BelongsTo) with custom collection (that supports notification if items were added/removed). Now the questions: - What modification should be done

[nhusers] Map the class with subscribable collection

2009-12-01 Thread Dmitiry Nagirnyak
Hi, I need to map 2 classes: Blog and Post. There is an association (blog.Posts-post.BelongsTo) with custom collection (that supports notification if items were added/removed). Now the questions: - What modification should be done to map the classes? - What XML mapping should look like?

[nhusers] Re: Requirements to Host NH

2009-11-08 Thread Dmitiry Nagirnyak
Anybody? 2009/11/6 Dmitiry Nagirnyak dna...@gmail.com Hi Guys, I want to prepare the requirements for hosting NH web application. But not very sure about it. Could you please help me with that? I don't want to limit the NH functionality (reflection optimizer, lazzy loading etc

[nhusers] Requirements to Host NH

2009-11-05 Thread Dmitiry Nagirnyak
Hi Guys, I want to prepare the requirements for hosting NH web application. But not very sure about it. Could you please help me with that? I don't want to limit the NH functionality (reflection optimizer, lazzy loading etc). These just must work. For that I need to provide full set of

[nhusers] Re: PreUpdate event listener and dynamic update

2009-11-05 Thread Dmitiry Nagirnyak
Did you return true from PreUpdate? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to

[nhusers] Re: Automatically create database if it does not exist

2009-10-29 Thread Dmitiry Nagirnyak
Yeah. I see what you mean here. And I went the same way. So I suppose at this stage it should be alright to do it using custom SQL from create database. Thanks a lot for your time spent for this question. Cheers. 2009/10/28 José A. Salvador Vanaclocha joans...@gmail.com So sorry but I don't

[nhusers] Re: Automatically create database if it does not exist

2009-10-28 Thread Dmitiry Nagirnyak
2009/10/28 José A. Salvador Vanaclocha joans...@gmail.com I have the integration tests that run against all supported databases. In my case they are MsSql and SqlLite. So I want to execute those tests against a real database (which SqlLite is too but can be thought as a mock DB too). If

[nhusers] Re: Automatically create database if it does not exist

2009-10-27 Thread Dmitiry Nagirnyak
. With trusted connection there are plenty of privileges. Just want to make sure this is correct approach (during unit testing at least). Cheers. 2009/10/27 José F. Romaniello joseromanie...@gmail.com The problem is that you need have rights to do that 2009/10/26 Dmitiry Nagirnyak dna...@gmail.com

[nhusers] Re: Automatically create database if it does not exist

2009-10-27 Thread Dmitiry Nagirnyak
Yes, of course, But you do that through the settings you define at nhibernate configuration which stores your credentials to access to explicit database, not the server database. And I can use those credentials to create database. And yes, the credentials do need privileges for that. No

[nhusers] Automatically create database if it does not exist

2009-10-26 Thread Dmitiry Nagirnyak
Hi, Just wondering is it is possible to tell NHibernate to create the database if it doesn't exists. Obviously, SchemaExport should not do it (and it doesn't). So lookead at Dialect but it doesn't look it has any interface to do that. Currently I workaround it by using my own interface where I

[nhusers] Re: XML Database

2009-10-16 Thread Dmitiry Nagirnyak
a feature started but there isn't a real request to end it. EntityMode.Xml. The query language is HQL or Criteria. 2009/10/13 Dmitiry Nagirnyak dna...@gmail.com Hi, Just to make sure. NHibernate does not support file based (XML or so) database. Right? Has anybody tried to implement file-based

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-04 Thread Dmitiry Nagirnyak
Could anyone please suggest? Am I doing it the right way? 2009/8/4 Dmitiry Nagirnyak dna...@gmail.com Only one thing I can do NOW to pass the test is modify the Product class: 1) Make Image setter non-public. 2) Change image via method. That will: 3) Retrieve the Session (via ServiceLocator

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-04 Thread Dmitiry Nagirnyak
Can't find how to do this (especially with FNH) :( Probably I need a component but stored in a separate table (BinaryContent with Id)? 2009/8/4 Fabio Maulo fabioma...@gmail.com Do you have tried a component in a join. 2009/8/4 Dmitiry Nagirnyak dna...@gmail.com Could anyone please suggest

[nhusers] Re: Schema Generation

2009-08-04 Thread Dmitiry Nagirnyak
was generated. I am using S#arp architecture. Any suggestions. On Aug 4, 9:57 am, Dmitiry Nagirnyak dna...@gmail.com wrote: new SchemaExport(cfg.Configuration).Execute(false, true, false, session.Connection, null); 2009/8/4 Sachin sachingupta1...@gmail.com Hi How can

[nhusers] Re: Assign property with no roundtrip to database

2009-08-03 Thread Dmitiry Nagirnyak
Ohh, Right! Thanks! 2009/8/3 jobsamuel samu...@gmail.com If you know the ID use Load instead of Get, Load will not hit the DB. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group. To post to this

[nhusers] Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
Hi, I have difficulty making the test below to pass. I need to tell NH that there's only 1 Image related to Product and if another is assigned the old one should be deleted. Some help please? // THE TEST [Test] public void ReplaceProductImage_DeletesOldRecord() { // Initialise var p = new

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
/tehlike On Mon, Aug 3, 2009 at 9:38 AM, Dmitiry Nagirnyak dna...@gmail.comwrote: Hi, I have difficulty making the test below to pass. I need to tell NH that there's only 1 Image related to Product and if another is assigned the old one should be deleted. Some help please

[nhusers] Re: Assign property with no roundtrip to database

2009-08-03 Thread Dmitiry Nagirnyak
CountryType : WellKnowInstanceTypeCountry { public CountryType() : base(new Countries(), (e, k) = e.Id == k, e = e.Id) {} } 2009/8/3 Dmitiry Nagirnyak dna...@gmail.com Hi, I'm sure it should be simple. How can I assign property (lookup value) without a DB roundtrip to obtain ID of the lookup

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
Noo! Tell me that's impossible! http://nhjira.koah.net/browse/NH-1262 :(( On 03/08/2009, Dmitiry Nagirnyak dna...@gmail.com wrote: It is not applicable to many-to-one. So it just doesn't work. It would be nice if I could do this. 2009/8/3 Tuna Toksoz tehl...@gmail.com all-delete-orhpans

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
I would first ask for your use-case. Why do you need to load all tree via query ONLY? Why can't you use different optimizations (fetch types etc) and retrieve the root of tree and then get all the rest the object. Yes, it won't make it in a single query. But you could easily flatten it to a

[nhusers] Re: Bidirectional Self Association

2009-08-03 Thread Dmitiry Nagirnyak
http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/05/14/how-to-map-a-tree-in-nhibernate.aspx On 03/08/2009, Ahmed Emad aemad...@gmail.com wrote: suppose that i have a class called emplyee which has self association by foriegn key manager can i have employee.manager

[nhusers] Re: Update a customer like this?

2009-08-03 Thread Dmitiry Nagirnyak
Start from the docs: https://www.hibernate.org/hib_docs/nhibernate/html/manipulatingdata.html#manipulatingdata-updating On 01/08/2009, Topflysecurity konnektgra...@gmail.com wrote: hi. im coding with asp.net, i got a Customer and Customer got a IList.. now when i add a new Customer and

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
Anybody please? 2009/8/3 Dmitiry Nagirnyak dna...@gmail.com Noo! Tell me that's impossible! http://nhjira.koah.net/browse/NH-1262 :(( On 03/08/2009, Dmitiry Nagirnyak dna...@gmail.com wrote: It is not applicable to many-to-one. So it just doesn't work. It would be nice if I could do

[nhusers] Re: Ambient session (thread local)

2009-08-03 Thread Dmitiry Nagirnyak
I use ServiceLocator in such cases: http://martinfowler.com/articles/injection.html#UsingAServiceLocator Yes, basically it is needed to have some statics. But it doesn't mean that ISession/ISessoinFactory should be stored static variables. What I do is: 1) ServiceLocator provides interface

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
I have just talked to my DBA and it seems the whole hierarchy CAN be loaded with a single SQL statement. In Oracle there's CONNECT BY. Sql Server is not as good here but still can do the job: http://dbbest.net/blog/?p=44 Probably other DBs can do it too. I don't *think* NH supports such stuff,

[nhusers] Re: Ambient session (thread local)

2009-08-03 Thread Dmitiry Nagirnyak
/CommonServiceLocatorAs you can see it has adapters for various IoC 2009/8/3 Dmitiry Nagirnyak dna...@gmail.com I use ServiceLocator in such cases: http://martinfowler.com/articles/injection.html#UsingAServiceLocator Yes, basically it is needed to have some statics. But it doesn't mean that ISession

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
. Your relation is Product-to-BinaryContent and BinaryContent has a different autonomy lify-cycle. Is the class BinaryContent used in some other relation with other classes ? 2009/8/3 Dmitiry Nagirnyak dna...@gmail.com Anybody please? 2009/8/3 Dmitiry Nagirnyak dna...@gmail.com Noo! Tell me

[nhusers] Re: Eagerly load recursive relation

2009-08-03 Thread Dmitiry Nagirnyak
any concrete advice. On Aug 4, 6:38 am, Dmitiry Nagirnyak dna...@gmail.com wrote: I have just talked to my DBA and it seems the whole hierarchy CAN be loaded with a single SQL statement. In Oracle there's CONNECT BY. Sql Server is not as good here but still can do the job: http

[nhusers] Re: Automatically delete old record when another value is assigned

2009-08-03 Thread Dmitiry Nagirnyak
to do handle this via mapping? Cheers, Dmitriy. 2009/8/4 Dmitiry Nagirnyak dna...@gmail.com Yes, BinaryContent can be used in other relations too. I don't mind to change the mapping to one-to-one, but it doesn't look like it solves this problem. I see what you mean about the cascade. When I

[nhusers] Re: Schema Generation

2009-08-03 Thread Dmitiry Nagirnyak
new SchemaExport(cfg.Configuration).Execute(false, true, false, session.Connection, null); 2009/8/4 Sachin sachingupta1...@gmail.com Hi How can I generate DB schema from the entities which I have designed in my code. Is there any specific tool for it. I had tried few code snippets using

[nhusers] Assign property with no roundtrip to database

2009-08-02 Thread Dmitiry Nagirnyak
Hi, I'm sure it should be simple. How can I assign property (lookup value) without a DB roundtrip to obtain ID of the lookup? // THIS IS WHAT I USED TO DO address.Country = Session.GetCountry(14); // THIS IS WHAT DO NOW address.Country = PredefinedCountries.Australia; The last approach work

[nhusers] Re: Static lookup classes

2009-07-31 Thread Dmitiry Nagirnyak
= Countries.Australia Does not look any good :( I am not sure how I can avoid this :( Any ideas? Cheers, Dmitriy. 2009/7/30 Nexus tommar...@gmail.com No problem does not have to go to the database to get the country :) On 30 jul, 09:42, Dmitiry Nagirnyak dna...@gmail.com wrote: Thanks

[nhusers] Re: Static lookup classes

2009-07-30 Thread Dmitiry Nagirnyak
save !!! On 30 jul, 07:20, Dmitiry Nagirnyak dna...@gmail.com wrote: Anybody please? 2009/7/29 Dmitiry Nagirnyak dna...@gmail.com Hi, I would like to use code like this for my lookup classes: if (address.Country == Countries.Australia) { // Do something

[nhusers] Re: Static lookup classes

2009-07-29 Thread Dmitiry Nagirnyak
Anybody please? 2009/7/29 Dmitiry Nagirnyak dna...@gmail.com Hi, I would like to use code like this for my lookup classes: if (address.Country == Countries.Australia) { // Do something } Here the Countries class is defined like this: public class Countries { public Country

[nhusers] Static lookup classes

2009-07-28 Thread Dmitiry Nagirnyak
Hi, I would like to use code like this for my lookup classes: if (address.Country == Countries.Australia) { // Do something } Here the Countries class is defined like this: public class Countries { public Country Austrlia { get { return ObtainLokupFromDB(Australia); //

[nhusers] Escaping Like

2009-07-27 Thread Dmitiry Nagirnyak
Hi, I have seen that a lot of people are escaping Expression.Like. Isn't there a generic way of doing LIKE avoiding the escaping? Why? Because of set of characters to that should be vary from Db to DB and thus we have to look into Factory/Config to make sure we escape correctly. Is there

[nhusers] Re: SaveOrUpdate and Delete inconsistency?

2009-07-27 Thread Dmitiry Nagirnyak
be using a strategy like identity which needs a flush to get the ID, but this is more an inevitable problem than a feature. Gustavo. On Mon, Jul 27, 2009 at 7:39 AM, Dmitiry Nagirnyak dna...@gmail.comwrote: Hi, Call Session.Delete(object) never executes the DELETE SQL. If I wrap

[nhusers] SaveOrUpdate and Delete inconsistency?

2009-07-26 Thread Dmitiry Nagirnyak
Hi, Call Session.Delete(object) never executes the DELETE SQL. If I wrap it in a transaction - it does. Additionally when I use Session.SaveOrUpdate(object) I don't need to wrap it in transaction or Flush. It does execute the SQL. Feels very inconsistent. Do I miss something? I do not provide

[nhusers] Re: datetime and timespan arithmetic in a hql where clause

2009-06-03 Thread Dmitiry Nagirnyak
Hi Fabio, 2009/6/4 Fabio Maulo fabioma...@gmail.com Ah.. there is another option. 1) study what is needed for each RDBMS 2) create a JIRA to add a new HQL function I'm not too sure exactly, so wouldn't bother guys with unrealistic stuff from top of my head. But for this particular example it

[nhusers] Re: datetime and timespan arithmetic in a hql where clause

2009-06-01 Thread Dmitiry Nagirnyak
ah... with DATEADD take care to use abbreviation instead full name... What if we don't know the underlying database server? How to deal with it in this case? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers

[nhusers] Re: Plug into SQL Logging

2009-06-01 Thread Dmitiry Nagirnyak
I'm using statistics in tests An example is here. Fabo, thanks again. I think it should be enough information for me to start playing with it :) Cheers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers

[nhusers] Re: datetime and timespan arithmetic in a hql where clause

2009-06-01 Thread Dmitiry Nagirnyak
You can register the corresponding function in your dialect extension (your custom dialect inherited from standard). Don't you mind to give a little more background please (sorry I'm really new to NH)? --~--~-~--~~~---~--~~ You received this message because you

[nhusers] Re: Lazy loading and static/no proxy

2009-05-29 Thread Dmitiry Nagirnyak
follow bad practice even when they come from Microsoft. Program to interface not to implementation. Try to explain when you need a cast to a concrete implementation instead an interface. 2009/5/28 Dmitiry Nagirnyak dna...@gmail.com Thanks. It's a good option. But what I really don't like

[nhusers] Re: Lazy loading and static/no proxy

2009-05-29 Thread Dmitiry Nagirnyak
This is what I ideally would like to achieve: Use the a code-injection mechanism to inject code in assemblies containing persistent classes to support lazzy loading

[nhusers] Re: Lazy loading and static/no proxy

2009-05-28 Thread Dmitiry Nagirnyak
Thanks. It's a good option. But what I really don't like with proxies is that I cannot rely on casting operations with them. So I would rather prefer to have classes in my code to support lazy loading. I suppose I can achive this by writing some additional code in setters/getters. Has anybody

[nhusers] Re: HQL vs Criterion

2009-05-19 Thread Dmitiry Nagirnyak
So Criteria API and HQL have different implementations? I thought they reuse the same infrastructure for generating SQL, mapping entities etc. I believe it should be true but probably not fully. Am I right here? To choose the right tool we need to know what that tool can and cannot do. So maybe