1 Reply Latest reply on May 17, 2010 9:41 PM by Raphael Rodrigues

    Getting hibernate sequence value before insert

    Raphael Rodrigues Newbie

      Hello guys,


      There is one field in my form when the user do not fill, my application should put the value from id inside this field and generate the insert.


      This value from id comes hibernate sequence like this:


      @Id
      @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_ORDEM_SERVICO")
      @Column(name="actordemservicoid")
      private Long ordemServicoId;



      That works fine. But, i can not get ordemServicoId before calls entityManager.persist() of my EntityHome. So, is there any way to get this sequence value?


      I am using hibernate 3.2.6 and seam 2.1.2...


      Thanks for any answer,