File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OneToMany not by ID

 
Alex Armenteros
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having problems with the OneToMany side of a relation.

2 models (with the appropiate getters and setters)





If I make the query from City table, I have no problem.

But I'm trying this.



and Hibernate (with Oracle) makes a Query like this.

select * from ( select this_.Serial as Serial2_0_, this_.CodeRegion as CodeRe2_2_0_, this_.DescRegion as DescRe3_2_0_ from region this_ where exists (select 1 from city where this_.Serial=CodeRegion) ) where rownum <= ?

I noted that part in Black as is using Serial column not using the CodeRegion

Any way to substitute the black part from this_.Serial to this_.CodeRegion?

 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know if this will help but,

try this:

 
Alex Armenteros
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried with no result but...


if I use something like this.




It works my way and your way [Not using mappedBy or using it] so... I suppose there is some kind of bug in "isNotEmpty" function.

Thank you for your time answering me.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic