java - Linq ".any" equivalent in HQL -


I have a NHibernate Linq query and I need to translate it into HQL:

 < Code> var result = Conexion.Session.Query & lt; Person & gt; (); Results = Results Where (P => p.addresses.Any (a => a.City.Name == "mycity"));  

"Mysticity" returns to people with at least one address in the city

How do I translate "any" segment as "HKL Senate" Can i

Thank you.

This is HQL equivalent:

  Add p.addresses to a.city c where c.name =: cityName  

any is solved by just one

If there are multiple addresses in the same city, in order to remove the duplicate of the person unit, you need to use the separate :

>  person Choose a different p from p.addresses to join a.city c where c.name =: cityName  

or

  Select to join a.city c to select a peepular p. where c: name =: cityName  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -