Hibernet - Oracle Question - Select and Filter

0 respostas
javahibernate
N

Hello All,

I need something really simple, but need your help to do this

I am using Hibernate with Oracle Database, and I am performing a Full query using “select b from Biossimilar_Entity b” as you can see bellow

@SuppressWarnings("unchecked")
public ArrayList<BiossimilarEntity> getAll() {
	Query query = em.createQuery("select b from Biossimilar_Entity b");
	return (ArrayList<BiossimilarEntity>) query.getResultList();
}

But I need two things, I need to apply to filters using Date Field;

@Column(nullable=false)
	@Temporal(TemporalType.DATE)
	private Calendar data_bio;

First:

I need to get this list ordered by date , from the first to last… Examplo: 01012015 then 01022015, then 01032015, etc. DD/MM/YYYY

Second

I need to get same list , but I only need the last 12 months… when I get this list today 27/07/2016 , i will need all months starting in 01/07/2015

Could someone help me please?

Criado 27 de julho de 2016
Respostas 0
Participantes 1