Here i an example of my criteria. I just changed the name of class and
properties:
Dim criteria As ICriteria =
session.CreateCriteria(GetType(Object).ToString) _
.CreateAlias("Property1", "property1") _
.CreateAlias("property1.Object1", "object1") _
.CreateAlias("object1.Object2", "object2") _
.CreateAlias("object2.Object3", "object3") _
.Add(Criterion.Expression.Eq("Id", parameter)) _
.SetProjection(Projections.SqlProjection("sum(cast(datalength(object3.Image)
as bigInt)) total", New String() {"total"}, types))
i need sum length of object3.Image that is type of varbinary.
On 24 jun, 09:19, Kminoru <[email protected]> wrote:
> In place of parameter "Data" i put the alias i want? i tryed with
> "Data" parameter and i got this exception: "Index was outside the
> bounds of the array."
> I got the SQL generated and executed on SQL Server and it´s ok.
> I tryed with the "imagem.Imagem", being "imagem" my alias and
> ".Imagem" my property and i got an exception from Database saying in
> portuguese: "O identificador de várias partes "imagem.Imagem" não pôde
> ser associado." ("The multi-part identifier" imagem.Imagem "could not
> be associated with.").
>
> Thx for answer.
>
> On 24 jun, 08:56, Kminoru <[email protected]> wrote:
>
>
>
> > Hey Diego, the string "dl" is alias of some property or just the name
> > of the column from answer?
>
> > On 23 jun, 15:50, Diego Mijelshon <[email protected]> wrote:
>
> > > .SetProjection(
> > > Projections.SqlProjection("sum(datalength(Data)) dl",
>
> > > new[] {"dl"},
>
> > > new[] {NHibernateUtil.Int64}))
>
> > > Diego
>
> > > On Wed, Jun 23, 2010 at 14:54, Kminoru <[email protected]> wrote:
> > > > i did
> > > > this:
> > > > .SetProjection(Projections.Alias(Projections.SqlProjection("sum(cast(datalength(imagem.Imagem)
> > > > as bigInt))", New String() {"imagem.Imagem"}, types), "total")) and
> > > > got this exception mensage:"O identificador de várias partes
> > > > "imagem.Imagem" não pôde ser associado."
>
> > > > Translated by google: "The handle multi-part "imagem.Imagem" could not
> > > > be associated"
> > > > What´s wrong?
>
> > > > On 23 jun, 11:21, Diego Mijelshon <[email protected]> wrote:
> > > > > You can use Projections.SqlProjection or .SqlGroupProjection to access
> > > > > arbitrary functions.
>
> > > > > Diego
>
> > > > > On Wed, Jun 23, 2010 at 09:37, Kminoru <[email protected]> wrote:
> > > > > > Hello, in my application, i need select de sum of length of some
> > > > > > objects. These objects are varbinary type. I found that SQL SERVER
> > > > > > has
> > > > > > the function datalength that return it. How can i do this using
> > > > > > criteria?
> > > > > > Thanks for all.
>
> > > > > > --
> > > > > > 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]<nhusers%[email protected]>
> > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroups.com>
> > > > >
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/nhusers?hl=en.-Ocultartextodas
> > > > mensagens anteriores -
>
> > > > > - Mostrar texto das mensagens anteriores -
>
> > > > --
> > > > 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]<nhusers%[email protected]>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.-Ocultartexto das mensagens
> > > >anteriores -
>
> > > - Mostrar texto das mensagens anteriores -- Ocultar texto das mensagens
> > > anteriores -
>
> > - Mostrar texto das mensagens anteriores -- Ocultar texto das mensagens
> > anteriores -
>
> - Mostrar texto das mensagens anteriores -
--
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.