Fabio,

Is there a JIRA for <subselect/>? If not, where can we see more
information?

Thanks,

RP


On Mar 27, 5:42 pm, Fabio Maulo <[email protected]> wrote:
> a view
>
> On Sat, Mar 26, 2011 at 8:30 PM, Krzysztof Kozmic <
>
>
>
>
>
>
>
> [email protected]> wrote:
> > Hey all,
>
> > @Fabio - the translations are currently inserter as part of database
> > setup script (not generated by NHibernate).
>
> > We're still on NHibernate 3.1 so the solution you mentioned is added
> > in 3.2 can't be used. Also the way I reported it I only showed you a
> > part of the picture. Reality is that you may have graph like this
> > (entities with * next to their names have associated translations
> > table):
>
> > foo*
> >  many-to-one: bar*
> >              many-to-one: baz*
>
> >  one-to-many: aaa*
> >  many-to-one: bbb*
> >              many-to-one: ccc
>
> > So you may have to fetch multiple types which makes the matter a bit
> > more complex.
> > Also since it's oracle, I'd prefer to avoid having too much SQL in my
> > mappings, that's why I like the solution with <join /> and where
> > clasuse in mapping.
>
> > regarding the error generated by NHibernate - well it does filter the
> > class, just not entire class, as it squashes a one-to-many
> > relationship between the <join />ed tables to a one-to-one. I know
> > that's usually not intended use, but can you see any real problem with
> > it if I use it that way?
>
> > Can you think of any other solution that would work in 3.1?
>
> > Thanks,
> > Krzysztof
>
> > On Mar 27, 6:09 am, Fabio Maulo <[email protected]> wrote:
> > > The usage of <join> mean a split of the root-entity in more than one
> > table.
> > > It was introduced only to give support to legacy-db that was designed
> > > without think in ORM; that is the real issue.
>
> > > On Sat, Mar 26, 2011 at 4:03 PM, Anne Epstein <[email protected]> wrote:
> > > > Fabio,
> > > > There is some chance this is fixed in NHibernate 3.X as I haven't
> > > > needed to use the <join> feature in a while, but Krzysztof's issue
> > > > sounded like a sister issue to one I ran across, researched and
> > > > reported, and that bug report is still unresolved:
> > > >http://216.121.112.228/browse/NH-1747
>
> > > > Also, another related issue that I'd made note of was this:
> > > >http://216.121.112.228/browse/NH-2009
> > > > which was patched and closed, but with a patch that assumes all keys
> > > > are either in the primary table OR the join table, but doesn't really
> > > > handle a mix. The patch there is an improvement for that case, but
> > > > doesn't cover all situations.
>
> > > > I've seen a number of other weird issues like Krzysztof's show up on
> > > > the mailing list that were related to wrong-table FK errors on join.
> > > > Unfortunately I didn't bookmark them, but I've seen a few-enough that
> > > > I'd think twice about putting anything but plain value properties in
> > > > the secondary table of a join.
>
> > > > Anne
>
> > > > On Sat, Mar 26, 2011 at 1:07 PM, Fabio Maulo <[email protected]>
> > wrote:
> > > > > Anne,
> > > > > can you point me to the list of actual open issues, about the
> > problems
> > > > you
> > > > > are talking about, in our JIRA ?
> > > > > where no available in the ticket, can you provide a failing test ?
> > > > > Thanks.
>
> > > > > On Fri, Mar 25, 2011 at 4:28 PM, Anne Epstein <[email protected]>
> > wrote:
>
> > > > >> The <join> mapping is problematic in that various features in
> > > > >> NHibernate will assume that fields, keys, etc are in the primary
> > table
> > > > >> that may actually be in the secondary table-resulting in errors.
> > > > >> There are a number of bugs in jira related to this kind of problem
> > > > >> with the <join> element.  At this point, until there is a real
> > > > >> solution that consistently makes NHibernate deal with this
> > > > >> relationship properly in all NHibernate features (and I wouldn't
> > hold
> > > > >> my breath), I'd avoid this mapping strategy unless you absolutely
> > have
> > > > >> to- you'll almost certainly hit some weirdness if you try anything
> > > > >> complex/interesting.
>
> > > > >> On Fri, Mar 25, 2011 at 1:25 PM, José F. Romaniello
> > > > >> <[email protected]> wrote:
> > > > >> > It is not the same, he is using a filter inside the "where"
> > attribute
> > > > >> > of the <class> to filter by a column in a <join>. It is different
> > to
> > > > >> > the formula of Ayende.... But im not sure if it might work
>
> > > > >> > 2011/3/25, Fabio Maulo <[email protected]>:
> > > > >> >> If you use that solution, please have a look to WARNING.
>
> > > > >> >> 2011/3/25 Krzysztof Koźmic <[email protected]>
>
> > > > >> >>> So I have a one-to-many tables in database that looks like the
> > > > >> >>> following
> > > > >> >>> (I'm on NHibernate 3.1):
>
> > > > >> >>> blog
> > > > >> >>>    id
> > > > >> >>>    title
> > > > >> >>>    author
>
> > > > >> >>> comments
> > > > >> >>>    id
> > > > >> >>>    blog_Id
> > > > >> >>>    languageid
> > > > >> >>>    comment
>
> > > > >> >>> and I want to map it to a *single* class with *single* comment
> > > > >> >>> property
> > > > >> >>> that maps to text column in comments table for current language.
>
> > > > >> >>> Basically the idea is identical to one ayende had few years
> > back:
>
> > > >http://ayende.com/Blog/archive/2006/12/26/localizingnhibernatecontext.
> > ..
>
> > > > >> >>> The difference is I try to accomplish this without subselect but
> > > > using
> > > > >> >>> <join /> instead (mostly because the table with translations has
> > > > more
> > > > >> >>> columns than just the text that I may need to include in my
> > joined
> > > > >> >>> class).
>
> > > > >> >>> So I created a solution for that and I'm also using filter to
> > pass
> > > > >> >>> language
> > > > >> >>> id to queries. I also have a noop property in my mapping for the
> > > > >> >>> languageid
> > > > >> >>> as well as where clause in my mapping that does the filtering.
>
> > > > >> >>> And here's the SQL that NHibernate generates:
>
> > > > >> >>> SELECT this_.Id           as Id0_0_,
> > > > >> >>>       this_.Author       as Author0_0_,
> > > > >> >>>       this_.Title        as Title0_0_,
> > > > >> >>>       this_1_.Comment    as Comment1_0_,
> > > > >> >>>       this_1_.LanguageId as LanguageId1_0_
> > > > >> >>> FROM   Blog this_
> > > > >> >>>       inner join Comment this_1_
> > > > >> >>>         on this_.Id = this_1_.Blog_id
> > > > >> >>> WHERE  (this_.LanguageId = 2 /* @p0 */)
>
> > > > >> >>> The SQL is invalid as the where should be on this_1_.LanguageId
> > as
> > > > the
> > > > >> >>> value comes from the joined table, not the main one.
>
> > > > >> >>> Also the LanguageId column is mapped as access="noop" which
> > TTBOMK
> > > > >> >>> should
> > > > >> >>> mean it won't be queried for so I'm surprised to see NHibernate
> > is
> > > > >> >>> trying
> > > > >> >>> to
> > > > >> >>> select it as well. To me it is just wasting bandwith.
>
> > > > >> >>> So I have two questions now.
>
> > > > >> >>> 1. How can I accomplish what I'm trying to get to.
> > > > >> >>> 2. Are those issues I mentioned (invalid where clause and
> > ignoring
> > > > >> >>> noop
> > > > >> >>> access) bugs in NHibernate or am I looking at it from the wrong
> > > > angle?
>
> > > > >> >>> Reproduction demo app (along with database dump) available here
> > if
> > > > >> >>> someone
> > > > >> >>> wants to play with it:http://ge.tt/5xoiqYY
>
> > > > >> >>> cheers,
> > > > >> >>> Krzysztof
>
> > > > >> >>> --
> > > > >> >>> You received this message because you are subscribed to the
> > Google
> > > > >> >>> Groups
> > > > >> >>> "nhusers" group.
> > > > >> >>> To post to this group, send email to [email protected].
> > > > >> >>> To unsubscribe from this group, send email to
> > > > >> >>> [email protected].
> > > > >> >>> For more options, visit this group at
> > > > >> >>>http://groups.google.com/group/nhusers?hl=en.
>
> > > > >> >> --
> > > > >> >> Fabio Maulo
>
> > > > >> >> --
> > > > >> >> You received this message because you are subscribed to the
> > Google
> > > > >> >> Groups
> > > > >> >> "nhusers" group.
> > > > >> >> To post to this group, send email to [email protected].
> > > > >> >> To unsubscribe from this group, send email to
> > > > >> >> [email protected].
> > > > >> >> For more options, visit this group at
> > > > >> >>http://groups.google.com/group/nhusers?hl=en.
>
> > > > >> > --
> > > > >> > Enviado desde mi dispositivo móvil
>
> > > > >> > --
> > > > >> > You received this message because you are subscribed to the Google
> > > > >> > Groups "nhusers" group.
> > > > >> > To post to this group, send email to [email protected].
> > > > >> > To unsubscribe from this group, send email to
> > > > >> > [email protected].
> > > > >> > For more options, visit this group at
> > > > >> >http://groups.google.com/group/nhusers?hl=en.
>
> > > > >> --
> > > > >> You received this message because you are subscribed to the Google
> > > > Groups
> > > > >> "nhusers" group.
> > > > >> To post to this group, send email to [email protected].
> > > > >> To unsubscribe from this group, send email to
> > > > >> [email protected].
> > > > >> For more options, visit this group at
> > > > >>http://groups.google.com/group/nhusers?hl=en.
>
> > > > > --
> > > > > Fabio Maulo
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > > "nhusers" group.
> > > > > To post to this group, send email to [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected].
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/nhusers?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "nhusers" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected].
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.
>
> > > --
> > > Fabio Maulo
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from
>
> ...
>
> read more >>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to