0
I need to make an appointment in HQL and I have this entity Hibernate.
@Entity
@Table(name = "TB_TIPO_DOCT", schema = "FEP")
@NamedQueries({
@NamedQuery(name = "TbTipoDoct.findAllDocumentosLiberados", query =
"SELECT t FROM TbTipoDoct t WHERE t.cdSituCnfr IS NULL ORDER BY
t.dsTipoDoct"),
@NamedQuery(name = "TbTipoDoct.findAllDocumentosNaoLiberados", query =
"SELECT t FROM TbTipoDoct t WHERE t.cdSituCnfr IS NOT NULL ORDER BY
t.dsTipoDoct") })
public class TbTipoDoct implements Serializable {
private static final long serialVersionUID = 1492325815547842716L;
@Id
@Basic(optional = false)
@Column(name = "NR_SEQU_TIPO_DOCT")
private Long nrSequTpDoct;
@Column(name = "CD_DOCT")
private Integer cdDoct;
The select
what I do is :
SELECT * FROM FEP.TB_TIPO_DOCT WHERE NR_SEQU_TIPO_DOCT = 259;
My HQL query :
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.getCurrentSession();
Query query = session.createQuery("from TbTipoDoct tb where tb.nrSequTpDoct=
:259");
She is correct?
Please try to elaborate titles that evoke your real doubt. Texts such as "doubt in query" is too generic and does not demonstrate the content of your question.
– Woss
Did your query work? tested it?
– Tuxpilgrim
Try running your select and if errors occur, post here.
– Marcus Martins