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

2009-08-10 Thread YJingLee
I met a problem when try to map an one-to-one relationship in a single table. For example there're two entities (Product and ProductDetail): public class Product { public virtual int ProductID { get; set; } public virtual string Name { get; set; } public virtual float Price { get;

[nhusers] Mapping Dictionaries - Surrogate Primary Key and Cascading

2009-08-10 Thread Carlos
Hi, On a mapped entity I have a Dictionarystring, string that is mapped successfully for data retrieval as follows: map name=Properties table=EntityProperty key column=EntityID/ index column=Title type=System.String/ element column=Value type=System.String/ /map

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

2009-08-10 Thread Jeffrey Zhao
I met a problem when try to map an one-to-one relationship in a single table. For example there're two entities (Product and ProductDetail): public class Product { public virtual int ProductID { get; set; } public virtual string Name { get; set; } public virtual float Price { get;

[nhusers] Kind of a novice question (Session.Save, Session.Flush, Transaction.Commit)

2009-08-10 Thread Andrey Shchekin (ashmind)
I have a question about the way session.Save works. I have a session, I open a transaction over this session, and then commit the transaction. There are two different things I am doing within session and transaction: 1. Load an entity and add another entity to one of its collections. This works

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

2009-08-10 Thread hival
To use associations your table should contain a foreign key. In your current table definition you should use component, and the mapping like this: class name=Product table=Product id name=ProductID column=ProductID generator class=hilo/ /id property name=Name/

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

2009-08-10 Thread Jeffrey Zhao
But component mapping cannot implement lazy load. Any ways to get both single table one-to-one mapping and lazy load? Jeffrey Zhao Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter: http://twitter.com/jeffz_cn -- From: hival hi...@ukr.net Sent:

[nhusers] Re: Query Caching

2009-08-10 Thread mattcole
Thanks for the responses. I have setup caching on the Person entity yes, I think I was misunderstanding how the query cache works, I was hoping to avoid a trip to the DB to retrieve the Ids. I'll have a read about the cache implementation options as well if HashtableCacheProvider is only for

[nhusers] finding unmapped properties in a class

2009-08-10 Thread chris
Hi, I recently came across the case where a mapping file was missing the mapping for a property in my class. I have a couple of fairly basic mapping tests already such as can_create_session_factory. I would like to create a all_properties_in_mapped_classes_are_mapped test. Is there anything in

[nhusers] Re: SDS Driver

2009-08-10 Thread John Rayner
SDS is not really a DB, at least not in the RDBMS sense. It's not relational at all. Given that NHib is an ORM (which emphasis on the Relational part) I'm not sure it makes sense. OTOH I expect that NHib would work against SQL Azure (http:// www.microsoft.com/azure/data.mspx) without needing

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

2009-08-10 Thread Fabio Maulo
lazy loading for components does not have any sense. 2009/8/10 Jeffrey Zhao je...@live.com But component mapping cannot implement lazy load. Any ways to get both single table one-to-one mapping and lazy load? Jeffrey Zhao Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter:

[nhusers] Re: finding unmapped properties in a class

2009-08-10 Thread Fabio Maulo
metadata from conf before BuildSessionFactory 2009/8/10 chris bikk...@gmail.com Hi, I recently came across the case where a mapping file was missing the mapping for a property in my class. I have a couple of fairly basic mapping tests already such as can_create_session_factory. I would

[nhusers] Re: IPropertyAccessor and nh 2.1

2009-08-10 Thread mathmax
Yes I want to load a collection property. So I use a IPropertyAccessor implementation to load and persist custom collections. It worked like a charm until now. I've fixed this bug by creating a new collection: public override void Set(object target, object value) { var val = new

[nhusers] Encrypted Password

2009-08-10 Thread Maik
Hey folks, due to security reasons we are forced to only store usernames and passwords in an encrypted format (prefered encryption algorythm is AES). Now I want to know, if NHibernate supports something like that. Or do I have to implement it myself? Thanks for your help. Nice Greets from

[nhusers] Re: Encrypted Password

2009-08-10 Thread Maik
Oh .. I forgot to tell you, that I mean the connectionstring in hibernate.cfg.xml Sorry for that. On 10 Aug., 16:31, Maik macgyver...@googlemail.com wrote: Hey folks, due to security reasons we are forced to only store usernames and passwords in an encrypted format (prefered encryption

[nhusers] Re: Encrypted Password

2009-08-10 Thread allan.ritc...@gmail.com
http://code.google.com/p/unhaddins/source/browse/#svn/trunk/uNhAddIns/uNhAddIns/UserTypes The connection string will have nothing to do with this implementation. On Aug 10, 10:32 am, Maik macgyver...@googlemail.com wrote: Oh .. I forgot to tell you, that I mean the connectionstring in

[nhusers] Re: Encrypted Password

2009-08-10 Thread Maik
Maybe you got me wrong. I want the connection string to be encrypted. On 10 Aug., 16:37, allan.ritc...@gmail.com allan.ritc...@gmail.com wrote: http://code.google.com/p/unhaddins/source/browse/#svn/trunk/uNhAddIns... The connection string will have nothing to do with this implementation.

[nhusers] Re: Encrypted Password

2009-08-10 Thread Fabio Maulo
http://nhforge.org/wikis/howtonh/dynamically-change-user-info-in-connection-string.aspx 2009/8/10 Maik macgyver...@googlemail.com Maybe you got me wrong. I want the connection string to be encrypted. On 10 Aug., 16:37, allan.ritc...@gmail.com allan.ritc...@gmail.com wrote:

[nhusers] Re: Encrypted Password

2009-08-10 Thread Dario Quintana
You can always use in the configuraton connectionstring_name in the web/app.config and then encrypt the file. Then you can read the connection string and decrypt it programmatically. On Mon, Aug 10, 2009 at 11:31 AM, Maik macgyver...@googlemail.com wrote: Hey folks, due to security reasons

[nhusers] ProjectionCriteria as Having Clause

2009-08-10 Thread imm102
Hi, I am trying to come up with a criteria to restrict an aggregate root based on a set of tagIds. public class Foo { public virtual int Id { get;set; } public virtual IListTag Tags { get;set; } } public class Tag { public virtual int Id { get;set; } public virtual string

[nhusers] Re: Encrypted Password

2009-08-10 Thread Ken Egozi
there are the facilities in ASP.NET that allow encryption of connection strings from connectionString section. On Mon, Aug 10, 2009 at 5:58 PM, Maik macgyver...@googlemail.com wrote: thanks fabio, this is what i have been looking for! =) On 10 Aug., 16:50, Fabio Maulo

[nhusers] Re: Encrypted Password

2009-08-10 Thread Fabio Maulo
For a moment I saw a mirage Jen talking about ASP.MVC... but was only a mirage ;) 2009/8/10 Ken Egozi egoz...@gmail.com there are the facilities in ASP.NET that allow encryption of connection strings from connectionString section. On Mon, Aug 10, 2009 at 5:58 PM, Maik

[nhusers] Castle or Linfu

2009-08-10 Thread srf
Moving to nhibernate 2.1 from 1.2 I noticed a performance problem doing proxying and I ended up noticing that castle dynamic proxy uses the .net Type builder and the type build seems to have a bug where its gets prgressivly slower the more types created. We have 300 different types in our domain

[nhusers] Re: Joins

2009-08-10 Thread Oskar Berggren
If you need to merge data from several tables into one entity the join statement might be for you. For collections you might instead want to look up using fetch mode join. /Oskar 2009/7/22 Sachin sachingupta1...@gmail.com: I need to know that if I have to get data from multiple database

[nhusers] Re: Castle or Linfu

2009-08-10 Thread Fabio Maulo
Somebody pointed us to the same problem we the same solution in uNhAddIns.Personally I saw some difference, in production, in a stress-tests (usage of CPU) but I'm not completely sure that the problem was only LinFu DynamicProxy. The real problem of LinFu, IMO, is this:

[nhusers] How can I map to entites so they have relation in the database but not in the domain model

2009-08-10 Thread Niclas Pehrsson
I have Organization and Article And I want to have an relation in the database but not int the Organization object and not in the article object. I thought to make a OrganizationAndArticleMapping that hade Organization and Article as properties, but that would make an new table which I don't

[nhusers] Re: Encrypted Password

2009-08-10 Thread Ken Egozi
ha ha ha :)It's ASP.NET core thing. anyway, the MS MVC stuff is actually a very good imitation of Monorail. almost as good ... :) On Mon, Aug 10, 2009 at 6:18 PM, Fabio Maulo fabioma...@gmail.com wrote: For a moment I saw a mirage Jen talking about ASP.MVC... but was only a mirage ;)

[nhusers] Re: Encrypted Password

2009-08-10 Thread Fabio Maulo
I'm afraid I will say the same soon for another FX. 2009/8/10 Ken Egozi egoz...@gmail.com ha ha ha :)It's ASP.NET core thing. anyway, the MS MVC stuff is actually a very good imitation of Monorail. almost as good ... :) On Mon, Aug 10, 2009 at 6:18 PM, Fabio Maulo fabioma...@gmail.com

[nhusers] Re: Encrypted Password

2009-08-10 Thread Tuna Toksoz
http://weblogs.asp.net/scottgu/archive/2006/01/09/434893.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 Mon, Aug 10, 2009 at 5:31 PM, Maik macgyver...@googlemail.com wrote: Hey folks,

[nhusers] Re: How can I map to entites so they have relation in the database but not in the domain model

2009-08-10 Thread Fabio Maulo
access=none 2009/8/10 Niclas Pehrsson pehrs...@gmail.com I have Organization and Article And I want to have an relation in the database but not int the Organization object and not in the article object. I thought to make a OrganizationAndArticleMapping that hade Organization and Article

[nhusers] Re: How can I map to entites so they have relation in the database but not in the domain model

2009-08-10 Thread Tuna Toksoz
Join? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 10, 2009 at 7:01 PM, Niclas Pehrsson pehrs...@gmail.com wrote: I have Organization and Article And I want to have an relation in

[nhusers] Dynamic OR's in NHibernate

2009-08-10 Thread lukefrice
I have been building an advanced search mechanism, and have now run into the requirement for dynamic OR statements and i do not know if there are any solutions possible with NHibernate. I will not know how many parameters will be searched for, so it has to be dynamic. Just so you understand, I am

[nhusers] Re: Encrypted Password

2009-08-10 Thread Tuna Toksoz
How soon depends, if it is the thing that I have in mind. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 10, 2009 at 7:39 PM, Fabio Maulo fabioma...@gmail.com wrote: I'm afraid I will

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread Tuna Toksoz
Criteria with disjunctions? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 10, 2009 at 7:43 PM, lukefrice lukefr...@gmail.com wrote: states, and they

[nhusers] How to limit query (parent child)

2009-08-10 Thread William Chang
I have two entities, List and ListItem. My List entity have a parent property: public virtual List listParent {get;set;}. My queries works when listParent is null, but when I set a parent for example, Countries parent list, and the child list is States. When I do a query on ListItem to pulls

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread lukefrice
Yes. Is there a way to do that? On Aug 10, 11:46 am, Tuna Toksoz tehl...@gmail.com wrote: Criteria with disjunctions? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike On Mon, Aug 10, 2009 at 7:43

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread Tuna Toksoz
https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/querycriteria.html https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/querycriteria.htmlLook for or. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz

[nhusers] Re: Trouble using two TableGenerators with different columns

2009-08-10 Thread Chris Nicola
I've tried this with HBM mapping files and the result is the same HBM2DDL only creates one column for the first generator it sees and ignores the parameters after that. The generator is configured correctly however as it is trying to get a value from the correct column. I will probably just have

[nhusers] Re: Trouble using two TableGenerators with different columns

2009-08-10 Thread Fabio Maulo
Note: you have inherited the behaviour of NHibernate.Id.TableGenerator that mean you should know what the behaviour is. If you want your own generator you should implements IPersistentIdentifierGenerator and IConfigurable (if needed) with all you need for your custom generator. 2009/8/10 Chris

[nhusers] Re: Castle or Linfu

2009-08-10 Thread srf
Well I finished running our integration tests and with linfu the tests took 900 seconds and with castle it took 1800 seconds so there is definatly some nasty stuff going on with castle . It all seems to be just with the typebuilder and proxying since creating and saving is the same with both

[nhusers] Re: Castle or Linfu

2009-08-10 Thread William Chang
Hey Scott, Can you please report your test case to the Castle Development Team. Thanks! http://groups.google.com/group/castle-project-devel Sincerely, William Chang On Aug 10, 1:44 pm, srf scott.fl...@cmgl.ca wrote: Well I finished running our integration tests and with linfu the tests took

[nhusers] Re: Castle or Linfu

2009-08-10 Thread Fabio Maulo
2009/8/10 srf scott.fl...@cmgl.ca This proxy plugin architecture in nhibernate was quite the lifesaver. You have seen the light. -- Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group.

[nhusers] NHibernate Plugin for Visual Studio 2008

2009-08-10 Thread mathmax
Hello, I would like to know if there is an update of this plugin for Visual Studio 2008: http://sourceforge.net/projects/nhibernateaddin/ or any similar product for Visual Studio 2008. Regards, mathmax --~--~-~--~~~---~--~~ You received this message because you

[nhusers] Re: ProjectionCriteria as Having Clause

2009-08-10 Thread imm102
Hi, I just upgraded to 2.1.0 and ProjectionCriteria is now no where to be seen :( Does anyone have any examples of how I can do this relatively common query? Thanks, On Aug 10, 3:58 pm, imm102 ianmmc...@gmail.com wrote: Hi, I am trying to come up with a criteria to restrict an aggregate

[nhusers] Re: How to limit query (parent child)

2009-08-10 Thread Fabio Maulo
A circular reference was detected while serializing an object of type JsonResult External issue. You should manage the serialization of your entities NH does not have nothing to do with it. 2009/8/10 William Chang diehardb...@gmail.com I have two entities, List and ListItem. My List entity

[nhusers] Re: Trouble using two TableGenerators with different columns

2009-08-10 Thread Chris Nicola
That was what I was wondering. Is this part of the expected behavior of TableGenerator? It seems to only be an issue with the DDL script generation. Other than that the TableGenerator functions as I need it to. I am guessing I need to change something in SqlCreateStrings() and

[nhusers] Re: Trouble using two TableGenerators with different columns

2009-08-10 Thread Chris Nicola
Hmmm I think I see an idea now, looking at how the Configuration is created I see how the SqlCreateStrings are called. What I need is to define a generator with a parameter for AllColumnNames and then a seperate one for TableName and ColumnName and then use AllColumnNames to generate the

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread lukefrice
Well i see that Or's can be applied, but I need them to be added dynamically, so if they want to select 28 states, then it has 28 or's added. I am using a method which is passing in all the criteria i need and then it returns them as an IQueryable and then it sends the whole query into

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread Tuna Toksoz
this is programatic, you have as much flexibility as your imagination. ICriterion x=something; if(something) x=Restrictions.Or(x,anotherRestriction); if(another) x=Restrictions.Or(x,anotherthinghere); Can I tell what I mean? Tuna Toksöz Eternal sunshine of the open source mind.

[nhusers] Re: How to limit query (parent child)

2009-08-10 Thread William Chang
What do you mean You should manage the serialization of your entities? You mean to create a special class for compatibility with JsonResult (ASP.NET MVC). Then, copy the properties from the populated model class by NHibernate to the properties in the special class? Another question, when

[nhusers] Re: NHibernate Plugin for Visual Studio 2008

2009-08-10 Thread Chris Nicola
I don't believe there are any up-to-date visual tools for nHibernate mapping right now. I think it would be cool to have one if it could generate clean HBMs that could then be edited, but I still doubt I would use one anymore. If you are working with an existing database you can use a code

[nhusers] Re: Castle or Linfu

2009-08-10 Thread Tuna Toksoz
Yes, this is very important for Castle project. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 10, 2009 at 8:47 PM, William Chang diehardb...@gmail.comwrote: Hey Scott, Can you please

[nhusers] Re: NHibernate Plugin for Visual Studio 2008

2009-08-10 Thread Fabio Maulo
There will be one soon for VS2010 if somebody want help a good point where start is studying T4 (Text Template Transformation Toolkit): http://msdn.microsoft.com/en-us/library/bb126445.aspx The new integration is produced by Microsoft:

[nhusers] Re: Castle or Linfu

2009-08-10 Thread Krzysztof Koźmic
Hey, This is actually not a Castle Dynamic Proxy issue per se. That's a result of... BCL's unfortunate implementation of algorithm that looks for name collisions in generated assembly. The algorithm is not linear, so you see the performance decrease you described, as there are more and more

[nhusers] Re: Castle or Linfu

2009-08-10 Thread Fabio Maulo
Thanks Krzysztof. 2009/8/10 Krzysztof Koźmic krzysztof.koz...@gmail.com Hey, This is actually not a Castle Dynamic Proxy issue per se. That's a result of... BCL's unfortunate implementation of algorithm that looks for name collisions in generated assembly. The algorithm is not linear, so

[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: NHibernate Plugin for Visual Studio 2008

2009-08-10 Thread Chris Nicola
That sounds awesome Fabio. Looking forward to seeing how that will work. Will be great for getting started with existing data stores. Chris On Mon, Aug 10, 2009 at 12:02 PM, Fabio Maulo fabioma...@gmail.com wrote: There will be one soon for VS2010 if somebody want help a good point where

[nhusers] Re: Castle or Linfu

2009-08-10 Thread srf
I think I never ran accross the performance issue with linfu because we redesigned it to no proxy our actual domain objects and created a parallell set of objects that get proxied because even the best interception times were still to slow for us and killed our simulator since the simulator would

[nhusers] Re: eager fetching over multiple levels, that's more than 2 :-)

2009-08-10 Thread Fabio Maulo
which is the question ? 2009/8/10 mhnyborg mhnyb...@gmail.com I just want to here if NH 2.1 has some new features that makes selection from 3 levels possible. for example I want to load all customers with all orders and order lines. I can get the Customers and orders using

[nhusers] Re: eager fetching over multiple levels, that's more than 2 :-)

2009-08-10 Thread mhnyborg
The question is: can I distinct load this object graph: Baselines- HasMany-BaselineMilestones-HasMany-BaselineMilestonePrevious var baselines = session.CreateQuery( from Baseline b left join fetch b.BaselineMilestones bm left join fetch bm.BaselineMilestonePrevious )

[nhusers] Re: NHibernate Plugin for Visual Studio 2008

2009-08-10 Thread mathmax
Yes, looks great! Do you think it will be available for VS 2010 beta 2 or the finale release? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups nhusers group. To post to this group, send email to

[nhusers] Re: Dynamic OR's in NHibernate

2009-08-10 Thread John Rayner
Create your own Disjunction object? Disjunction disj = new Disjunction(); for(int i = 0; i numRestrictions; i++) disj.Add( Restrictions.Eq( ) ); If not this, then please give an example of the sort of code you'd like to write. Cheers, John On Aug 10, 8:15 pm, lukefrice

[nhusers] Re: eager fetching over multiple levels, that's more than 2 :-)

2009-08-10 Thread Dario Quintana
If your question is how to do it, here you have an example: *select o from Order o join fetch o.Lines li join fetch li.Article where o.Id = :Id* OR * s.CreateCriteria(typeof (Order)) .SetFetchMode(Lines, FetchMode.Join) .SetFetchMode(Lines.Article,

[nhusers] Re: eager fetching over multiple levels, that's more than 2 :-)

2009-08-10 Thread Fabio Maulo
but... you should understand the difference between set and bag ;) P.S. bag es una bolsa de gatos. 2009/8/10 Dario Quintana conta...@darioquintana.com.ar If your question is how to do it, here you have an example: *select o from Order o join fetch o.Lines li join fetch li.Article where o.Id

[nhusers] Re: eager fetching over multiple levels, that's more than 2 :-)

2009-08-10 Thread Martin Nyborg
Thanks for reply. But I have 3 collection var baselines = session.CreateQuery( from Baseline b left join fetch b.BaselineMilestones bm left join fetch bm.BaselineMilestonePrevious) .SetResultTransformer (Transformers.DistinctRootEntity)

[nhusers] Re: Exists/Join in NHibernate

2009-08-10 Thread John Rayner
Check out http://ayende.com/Blog/archive/2006/10/28/QueryingCollectionsInNHibernate.aspx. It demonstrates EXISTS sub-queries nicely, through HQL and through criteria. Cheers, John On Aug 6, 1:01 pm, Marvin Massih marvin.mas...@googlemail.com wrote: On 6 Aug., 13:27, Jakob Tikjøb Andersen

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

2009-08-10 Thread Jeffrey Zhao
So what I need is mapping an one-to-one relationship in a single table like I demonstrated in the original mail. How can I do? Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter: http://twitter.com/jeffz_cn From: Fabio Maulo Sent: Monday, August 10, 2009 9:32 PM To: nhusers@googlegroups.com

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

2009-08-10 Thread Jeffrey Zhao
So what I need is mapping an one-to-one relationship in a single table like I demonstrated in the original mail. How can I do? Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter: http://twitter.com/jeffz_cn From: Fabio Maulo Sent: Monday, August 10, 2009 9:32 PM To: nhusers@googlegroups.com