Satish Patro

Greenhorn
+ Follow
since Nov 07, 2019
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Satish Patro

After searching through internet never found a proper solution, just doing for loop, in Exception block catching exception stack, if no exception null
if not null, again next iteration in for loop
each iteration if not null, add it to List<String> for audit
and make this whole thing async if possible as one round may take around 7/8 seconds
Temporary solution what I am doing now is, saving both object differently from Repo. Not saving from owned side.

Employee emp = new Employee();
emp.setEmpCode(“Zenitsu”);
emp.setEmpCode(“NY”);
Employee responseEmp  = empRepo.save(emp);

LoginUser loginUser = new LoginUser();
loginUser.setUserName(“Zenitsu12”);
loginUser.setIsLocked(false);
loginUser.setEmployee(responseEmp);
loginRepo.save(loginUser);

But, fot fetching it's stackoverflow error as I mentioned in my previous comment
4 years ago
one temporary solution.
I am saving both repo differently.

Means no use of bidirectional mapping while saving.'But, when I am trying to fetch
LoginUser from Employee like

emp.getLoginUser(),
In trace, it's showing it's fetching both table, then shows StackOverflow error, even If I provide fetchtype lazy
4 years ago
Sorry for the incnovenience.
I renamed Entity name before posting.

It will be
Caused by: org.hibernate.AssertionFailure: non-transient entity has a null id: com.titan.poss.user.dao.LoginUser.

I will edit it in the question.


"What the error actually means is that you're attempting to store a record without having first assigned it a unique primary key value."

But, I am setting both table's primary key & doing cascade all. How does it not have primary key?
4 years ago
Employee (empCode, empAddress, email)

LoginUser (userName, isLocked, empCode(fk @oneToOne))
LoginUser table contains empCode as foreign key.


I tried without cascade on both side too, everything. But, it’s going into infinite loop to StackOverFlowError.

Same for save employee too


I am getting Error. This scenario where CascadeType.ALL is even there
Caused by: org.hibernate.AssertionFailure: non-transient entity has a null id: com.titan.poss.user.dao.UserLogin

And in hashcode I am excluding the other Object too
4 years ago