Home  >  Forum  >  Hibernate
Post New Query

Unable to locate row for retrieval of generated properties



Asked on May 28, 2013
Hello Friends,

Help me to resolve the below error.

 org.hibernate.HibernateException: Unable to locate row for retrieval of generated properties: 
at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3986)
at org.hibernate.persister.entity.AbstractEntityPersister.processInsertGeneratedProperties(AbstractEntityPersister.java:3959)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:89)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:179)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)




Replied on May 28, 2013
Jay, explain what are you doing.



Replied on May 28, 2013
I am getting when I am using the below code snippet.

@Id
@Generated(GenerationTime.INSERT) 
@Column(name = "cust_id",insertable=false)
 private int custId;




Replied on May 28, 2013
I think you need not to use @Generated(GenerationTime.INSERT)
with id column. I think you should like this
    @Id
    @GeneratedValue
    @Column(name = "cust_id")
       private int custId;
and make cust_id auto increment

Find one reference URL.

http://www.concretepage.com/hibernate/example-generated-hibernate.php


Write Answer







©2019 concretepage.com | Privacy Policy | Contact Us