This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@OneToMany returning duplicate collection

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting filtered 'Trainer' entities, but collection (trainedMonkeys) is not filtered. 'trainedMonkeys' variable is holding all 'Monkey' objects instead of holding only the one with 'isThumb = true'.

Can someone please check if below criteria I am using is correct?




Trainer.java


Monkey.java


I am executing below code in the controller,


and the output is as below (Text marked in RED is not expected as it is marked as 'isThumb=false' in the database and hence should not be shown. Please suggest...),
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>
Trainer ID*****88
Trainer Name******TrainerSachin
Monkey ID*****87
Monkey Name*****Monkey_1

Monkey ID*****88
Monkey Name*****Monkey_2
Monkey ID*****89
Monkey Name*****Monkey_3

<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>
Trainer ID*****89
Trainer Name******TrainerVinod
Monkey ID*****90
Monkey Name*****Monkey_5

Monkey ID*****91
Monkey Name*****Monkey_6
Monkey ID*****92
Monkey Name*****Monkey_7

<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic