I have list of records of type class A ,let's say List<A> list=new ArrayList<A>();
.
Now i am trying to a save every record of A into database by using session.save();
.
If my second records fails then rest of my records are failed. In that case i try to remove that second record from the session by using session.evict(obj)
. But still I am getting the same behaviour.
Below is the code :
for(A a:list){
try{
session.save(a);
}
catch{
log.exception("Primary key");
session.evict(a);
}
}