Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@OneToMany returning multiple rows

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

I have spent a couple of hours finding solution online but in vain. Please help.

Article.java


Each Article has 3 images in Image table and hence I am CORRECTLY getting 3 rows. I want to filter records to match criteria "where Image.IMG_NAME like ("%_0.jpg")". You can see I tried using both "WhereJoinTable" and "FilterJoinTable" but it is not working.

Query I can see on the console is,


This is a correct behavior but I want to add 'where' clause to get only one record (with image name ending with "_0.jpg").

Tables,







It is just not working. Please suggest. Let me know if are more details are needed...
 
Urvaksh Rogers
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try to Extend image and create a class DefaultImage with a @Where clause

And in Article.java you would place a list of DefaultImage.

I remember reading a JIRA bug stating that @WhereJoinTable has a problem with either @OneToMany or @ManyToOne. Not sure, try this approach and let me know if it works!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic