JPA manytomany unidirectional mapping?

Ok, you should have a bi-directional Many-to-Many relationship between your Task and Source. And clearly from your requirements, the Source should be the owning side in the relationship and donot use CascadeType=All when defining the relationship on the Source side, but use it on the Task side. If you do have the bi-directional relationship then you wouldn't have to check the entire lists of all the Tasks.

That portion of the code is quadratic, it can be easily optimized using the b-directional mapping. Also if you make the Source the owning side without cascading options, the dependency is on the Source to attach/detach itself from the task. So all you would then need to do is.

Ok, you should have a bi-directional Many-to-Many relationship between your Task and Source. And clearly from your requirements, the Source should be the owning side in the relationship and donot use CascadeType=All when defining the relationship on the Source side, but use it on the Task side. If you do have the bi-directional relationship then you wouldn't have to check the entire lists of all the Tasks.

That portion of the code is quadratic, it can be easily optimized using the b-directional mapping. Also if you make the Source the owning side without cascading options, the dependency is on the Source to attach/detach itself from the task. So all you would then need to do is: if(source.getTaskList().size() == 1) { //remove the task source.getTaskList().

Get(0), this will remove the source also } else { //remove the source. The task is unaffected, as the source is the owning side }.

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