deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael Pestano <rmpest...@gmail.com>
Subject Criteria select attribute from relashionship
Date Tue, 19 Jul 2016 13:56:05 GMT
Hi guys,

I have a OneToMany relashionship between entities A and B and want to
select atributes from B in resulting criteria query, example:

List<User> users = criteria().
        select(User.class,attribute(User_.id), attribute(User_.name),
attribute(Tweet_.content)).
        join(User_.tweets,
                where(Tweet.class,javax.persistence.criteria.JoinType.LEFT).
                likeIgnoreCase(Tweet_.content, "%tweet%")).
        distinct().
        createQuery().setFirstResult(0).setMaxResults(2).
        getResultList();


in example above I was not able to select the column named 'content' from
Tweet table.

Any ideas? thanks in advance.



-- 
Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message