Fórum

Service Builder: how to get all from db order by CreateDate

Adrian Pol, modificado 6 Anos atrás.

Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 49 Data de Entrada: 14/03/17 Postagens Recentes
i want build a findAll but orderning with createDate, actually we have a getDomain with a simple findAll(start,end) but this don't return a list order by date, how could do that?

in service.xml we have:

<order by="asc">
<order-column name="name" />
<order-column name="createDate"/>
</order>

but when put domainPersistence.findAll have only findAll(start,end) nothing order by date emoticon

please help
and thank you! emoticon
thumbnail
Raja M, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

New Member Postagens: 3 Data de Entrada: 17/02/17 Postagens Recentes
U r ordering by both name and createDate

order by createDate
Adrian Pol, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 49 Data de Entrada: 14/03/17 Postagens Recentes
now i have this.

<order by="desc">
<order-column name="createDate" order-by="desc" />
</order>

and nothing i don't know why, but don't order by date when use findAll(start, end);

i want something like this: select * From redirector_regla order by modifiedDate desc;
thumbnail
Suresh Nimmakayala, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Liferay Master Postagens: 690 Data de Entrada: 18/08/04 Postagens Recentes
you don't need to repeat

order-by="desc" /> in order-column

that's why your changes are not redeployed

<order by="desc">
<order-column name="createDate"></order-column>
</order>
Adrian Pol, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 49 Data de Entrada: 14/03/17 Postagens Recentes
It's possible of do or i have sort by date the list with Bubble method?
Adrian Pol, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 49 Data de Entrada: 14/03/17 Postagens Recentes
No help emoticon
Harsh Kanakhara, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 74 Data de Entrada: 06/04/17 Postagens Recentes
I don't know if you are doing it for custom entity or liferay entity. But you can do sorting on list using this.

I am sorting blog entries on created date

Collections.sort(blogEntryList, new Comparator<blogsentry>() {
		    public int compare(BlogsEntry be1, BlogsEntry be2) {
		        return be1.getCreateDate().compareTo(be2.getCreateDate());
		    }
		});</blogsentry>


I hope it helps. emoticon

Regards,
Harsh Kanakhara.
Adrian Pol, modificado 6 Anos atrás.

RE: Service Builder: how to get all from db order by CreateDate

Junior Member Postagens: 49 Data de Entrada: 14/03/17 Postagens Recentes
it's solved thank you sooooo muuuuuch for your help Hash!!!! emoticon

the problem was that liferay don't deploy well the portlet and leave the same configuration in the portlet of webapps emoticon