Hi,

i have problems to get id from a stored procedure. I'm getting allways the 
"NOK" value from my Generator. (Problem with persistence context ?)

Is it possible, or what am I doing wrong? 


  |     @GenericGenerator(name="next_id", 
strategy="com.myapp.DBSequenceGenerator")
  |     @Id @GeneratedValue(generator="next_id")
  |     @Column(name = "product_id", unique = true, nullable = false, length = 
20)
  |     @NotNull
  |     @Length(max = 20)
  |     public String getProductId() {
  |             return this.productId;
  |     }
  | 
  | 


  | @Stateless
  | public class DBSequenceGenerator implements IdentifierGenerator {
  |     
  |     @PersistenceContext
  |     EntityManager em;
  |     
  |     public DBSequenceGenerator() {
  |             // empty constructor
  |     }
  |     
  |     public Serializable generate(SessionImplementor arg0, Object arg1) 
throws HibernateException {
  |     try {
  |              Query q = em.createNativeQuery("select get_next_id from 
get_next_id('nativequery')");
  |              //........
  |     } catch (Exception e) {
  |             return "NOK";
  |     }
  |             return "OK";
  |     }
  | }
  | 


Thank you!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024939#4024939

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024939
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to