Orderby does not work in java

Asked

Viewed 88 times

0

I have the following structure: a contract, has several additives then I have my contract class and my additive class

in contract class, I call it:

@OneToMany(mappedBy = "contrato", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Aditivo> aditivo;

only that I need this list to be sorted by the date field then I switched to

@OneToMany(mappedBy = "contrato", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@OrderBy("data ASC")

but when I do it makes a mistake

JBAS014777:   Services which failed to start:      service jboss.persistenceunit."contratos.war#contratos": org.jboss.msc.service.StartException in service jboss.persistenceunit."contratos.war#contratos": Failed to start service

already tried @Orderby(name="date") tb

MY ADDITIVE ENTITY: then have the getters and setters

@Entity
@Table(name="aditivo",schema="contratos")
public class Aditivo implements Serializable{
private static final long serialVersionUID = 2379719760666156224L;

@Id
@GeneratedValue
private Long id;

@Column(length = 300)
private String tipo;

@Column
private Boolean pdf;



public Boolean getPdf() {
    return pdf;
}

public void setPdf(Boolean pdf) {
    this.pdf = pdf;
}

@Column
private Date data;

@Column(length = 300)
private String numero;

@Column(length = 500)
private String objeto;

@ManyToOne
@JoinColumn(name="contrato", referencedColumnName = "id")   
private Contratos contrato;
  • Show the Additive entity

  • edited above...

  • http://stackoverflow.com/questions/22422089/failed-to-start-service-jboss-persistenceunit-org-hibernate-service-unknownserv

  • is if there is no other solution? it’s only when I add this line by that error happens, if I return, it normalizes

1 answer

0

Browser other questions tagged

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