• Post Reply Bookmark Topic Watch Topic
  • New Topic

To Get back primary seq key after persist JPA  RSS feed

 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
I am using JPA entityManager to save data. DB Connection is made through Hibernate.
The problem is that when I am saving the data I want to get back the primary key.
the problem can be easily understood just by looking at the code and the comment.
In the orm-maping.xml


Now in the DAO I am having one method as follow:-
 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the answer.
the primary key is getting stored in the bean of Application applicant variable.
applicant.getId();
Just never thought of that
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!