JPA: Eclipselink does not persist bi-directional relationships in database?

Ensure you are setting both sides of the relationship. The specification requires that the application sets both sides of the relationship as there is no relationship maintenance in JPA.

I have relationship maintenance code. But neither side of the relationship is reflected in the db. So this must be another issue.

– Theo Oct 22 '10 at 15:09.

Four points: 1. - When you have an error, it's more simple find solution isolating them in an example (Or unit test) that reproduces the error. In your case, you could do an example with more simple getter and setter (for example, removing unmodifiableList use and other innecesary methods for testing actually issue).2.

- I advise you to use pojos for model, without any logic. So, remove logic from pojos.3. - We are using eclipselink and we do not have problems persisting relations.So, it is more possible that error will be in your code.4.

- Test annoting relation with "cascade = javax.persistence.CascadeType. ALL" Apology for my poor English :(.

Yeah, you're right, there must be something wrong with my code. I didn't put any logic in my pojos. What you see is relationship management code for managing the in-memory relationship of entities.

– Theo Oct 25 '10 at 20:03.

After endless hours of trying I finally got to a solution: I simply changed the owning side of the relationship, i.e. I put the mappedBy attribute to the category entity like this: @ManyToMany(mappedBy= "categories") private List users; The explanation for this can be found here.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions