-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Disjunction problem
PostPosted: Thu Jun 16, 2011 5:40 am 
Newbie

Joined: Thu Jun 16, 2011 5:09 am
Posts: 1
I got the following class
public class Documento
{
public Soggetto Emittente { get; set; }
public Soggetto Destinatario { get; set; }
public IEnumerable<RigaDocumento> Righe { get }
...
}
public class Soggetto{
string Denominazione
...
}

And i need to find all the RigaDocumento of a Documento where all the Subject (Emittente && Destinatario) is in like a list of string
exemple:
(Documento.Emittente.Denominazione like %+"Name1"+% or Documento.Emittente.Denominazione like %+"Name2"+% ) or
Documento.Destinatario.Denominazione like '%+"Name1"+% or Documento.Destinatario.Denominazione like '%+"Name1"+% )
i have tryed with
-->exp.Soggetti is my list of string

(TypeFinderHelper.GetPathSafe return the full path of the type ex: TypeFinderHelper.GetPathSafe<Documento>(x => x.Emittente) return "Documento.Emittente")
\\\
var c = Session.CreateCriteria<RigaDocumento>();
var DocCrit = c.CreateCriteria(TypeFinderHelper.GetPathSafe<RigaDocumento>(x => x.Documento), typeof(Documento).Name);

var sogDisj = Restrictions.Disjunction();
var emiCrit = DocCrit.CreateCriteria(TypeFinderHelper.GetPathSafe<Documento>(x => x.Emittente));
var desCrit = DocCrit.CreateCriteria(TypeFinderHelper.GetPathSafe<Documento>(x => x.Destinatario));
foreach (var sog in exp.Soggetti)
{
sogDisj.Add(Restrictions.InsensitiveLike(TypeFinderHelper.GetPathSafe<Soggetto>(x => x.Denominazione), sog.Denominazione));
}
emiCrit.Add(sogDisj);
desCrit.Add(sogDisj);
return c.List<RigaDocumento>()
\\\

the expression result in ( Documento.Destinatario.Denominazione like "s0" or Documento.Destinatario.Denominazione like "s1") AND ( Documento.Emittente.Denominazione like "s0" or Documento.Emittente.Denominazione like "s1" )

Help pls!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.