aspose file tools*
The moose likes JSP and the fly likes @OneToMany returning duplicate collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "@OneToMany returning duplicate collection" Watch "@OneToMany returning duplicate collection" New topic
Author

@OneToMany returning duplicate collection

sachin pachpute
Ranch Hand

Joined: Aug 05, 2004
Posts: 35
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

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



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: @OneToMany returning duplicate collection