Substring in a Querydsl

Asked

Viewed 11 times

0

I have a class called Methodoavaliacaoprecojusto, it has 3 fields called link1, Link2 and link3. I want to get a list of all domains without repeating.

In that case the links would come https://www.google.com/search... but I just need the www.google.com

I also need to check if there is no repeat domain.

I thought of doing a query by taking all the links and then doing the checks and everything else, but if there is a possibility to do everything in the query would be great.

List<String> links = new JPAQuery<MetodoAvaliacaoPrecoJusto>(jpaApi.em()).from(QMetodoAvaliacaoPrecoJusto.metodoAvaliacaoPrecoJusto)
                .select(QMetodoAvaliacaoPrecoJusto.metodoAvaliacaoPrecoJusto.link1)
                .where(QMetodoAvaliacaoPrecoJusto.metodoAvaliacaoPrecoJusto.avaliacao().id.eq(avaliacao.getId()))
                .fetch();

With this query I can get a list of all links1, where QMetodoAvaliacaoPrecoJusto.metodoAvaliacaoPrecoJusto.avaliacao() is the FK of avaliacao.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.