[nhusers] Error deleting an entity with a lazy component

2012-02-22 Thread hival
When I try to delete an entity which has a lazily loaded component the ISession.Delete method throws the following exception: Unable to cast object of type 'System.Object' to type 'Namespace.ComponentClass'. If I initialize the component before deleting the entity then the ISession.Delete method su

[nhusers] Error deleting an entity with a lazy component

2012-02-22 Thread hival
When I try to delete an entity which has a eazily loaded component the ISession.Delete method throws the following exception: Unable to cast object of type 'System.Object' to type 'Namespace.ComponentClass'. If I initialize the component before deleting the entity then the ISession.Delete method su

[nhusers] Eager load lazy component

2012-02-20 Thread hival
Does Linq provider in NH 3.x support eager loading lazy components? I know about "fetch all properties" option in HQL but I'd like to use Linq. Thanks. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googl

[nhusers] Re: problem with SQLCE4 and NHibernate 3.2.* with mapping Bag collection by code

2011-12-29 Thread hival
Try this Bag( x => x.AssemblyBlockList, map => { map.Table( "PNP_AssemblyBlock" ); map.Key( k => k.Column( "IdProject" ) ); map.Cascade( Cascade.None ); map.Lazy( CollectionLazy.NoLazy ); map.Inverse( true ); }, rm => rm.OneToMany()); -- You received this message because you

[nhusers] Optional joined component/property: is this a correct behavior?

2011-10-04 Thread hival
I like the idea of the optional joined component or property. It allows me to factor optional properties out from the main table to a dedicated table thus allowing me to eliminate nullable columns in the main table. Unfortunately I noticed that though I mapped joined properties as optional (with

[nhusers] Re: Association 1 : 0..1 mappings

2011-05-31 Thread hival
Correction: constrained="true" should be omitted in your case, that is I was just looking at SQL generated by NH with this option enabled and disabled and forgot to remove it before pasting code to the answer. -- You received this message because you are subscribed to the Google Groups "nhuser

[nhusers] Re: Association 1 : 0..1 mappings

2011-05-31 Thread hival
Looking at your DB schema it seems that you want to map one-to-one association with a shared PK. I can suggest the following solution which conform to your DB schema: Osoba

[nhusers] NH3.x and show_sql

2011-05-29 Thread hival
I noticed that NH3.x doesn't take into consideration value of show_sql setting for some SQL statements. When show_sql setting enabled NH3.x doesn't log INSERT, UPDATE, DELETE statements to the console. This bug was noticed on MsSql2008Dialect. I agree that this is a minor issue but it's sometime in

[nhusers] Re: Using session inside user type implementation

2010-03-07 Thread hival
could you elaborate on the idea of using proxy a little more On Mar 7, 8:52 am, Fabio Maulo wrote: > I'm seeing a proxy not a usertype > > 2010/3/7 hival > > > > > > > Yes. > > The user type I'm currently developing is bound to a string co

[nhusers] Re: Using session inside user type implementation

2010-03-07 Thread hival
nd query DB for additional data. Then I need to assemble the data retrieved from DB and return as a class. On Mar 7, 3:02 pm, Fabio Maulo wrote: > query DB inside an implementation of IUserType ? > > 2010/3/7 hival > > > > > > > In my current implementation of NH user type

[nhusers] Using session inside user type implementation

2010-03-07 Thread hival
In my current implementation of NH user type I need to query a DB for some additional data. What is the safe/correct way to obtain a session in this case? Can I use a current/ambient session or I should open a new session based on the DB connection of the current session? Thank you in advance. --

[nhusers] Re: Circular Reference mapping

2010-02-20 Thread hival
I'm not sure whether it is the optimal solution but it works

[nhusers] Re: Table per concrete class, legacy db, and association

2010-02-15 Thread hival
the following somewhat abbreviated mapping work btw the strategy you described is called "Table per class hierarchy"

[nhusers] Re: Component being used as an ID

2009-08-19 Thread hival
maybe this example will help [Serializable] public class ClassId { public ClassId() { } public virtual string StringId { get; set; } public override bool Equals(object obj) { ... } public override int GetHashCode() { ... } } --~--~-~--~~~--

[nhusers] Re: NHibernate Mapping Many-To-Many Relationship

2009-08-19 Thread hival
cascade="save-update" on both bags will help --~--~-~--~~~---~--~~ 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 t

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

2009-08-17 Thread hival
When initializing a collection NH doesn't consider the case that the foreign key of the collection can be joined from another table. NH assumes that the FK belongs to the table to which entity from the collection has been mapped. here is my test DB schema create table A ( a_id int not null ident

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

2009-08-17 Thread hival
.koah.net/browse/NH-1747 > > If this bug is a problem for you, it can't hurt to vote for/comment on > the bug there... > > > > On Sun, Aug 16, 2009 at 8:24 AM, hival wrote: > > > I have a simple hierarchy of cla

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

2009-08-16 Thread hival
I have a simple hierarchy of classes mapped with the "subclass + join" strategy: and another entity is supposed

[nhusers] Re: Lazy load of one-to-one association

2009-08-15 Thread hival
Hmm... Here is my mapping and SQL (NH2.1.0) Parent

[nhusers] Re: Lazy load of one-to-one association

2009-08-15 Thread hival
Try to specify constrained="true" in the User's side of the association.I'm not sure whether it is correct but it works. It seems that NH doesn't look at the other side of the one-to-one assoc. to find out whether the assoc. is optional or not. --~--~-~--~~~---~--~--

[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: Remove ProductID property from ProductDeta

[nhusers] Re: Mapping question Composite Key

2009-08-06 Thread hival
I'm not sure whether I clearly understand your question, but a composite foreign key is mapped like this --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhu

[nhusers] Re: collection in a component without reference to the component's container

2009-07-25 Thread hival
as far as I know unidirectional assotiations are only possible when a foreign key of an association allows null values ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to

[nhusers] Re: Missing "where" clause in the "select" query in the TableGenerator class

2009-07-19 Thread hival
I see that it's corrected in NH2.1.0GA. Thank you. --~--~-~--~~~---~--~~ 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 e

[nhusers] Missing "where" clause in the "select" query in the TableGenerator class

2009-07-09 Thread hival
In my opinion the "select" query of the TableGenerator class should also contain "where" clause like the "update" statement of this class do. The "select" query always fetches the first row of the "next_hi_value" table and in the case when we have several rows in the "next_hi_value" table "update"