Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate many-to-many error

 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm having trouble to query a many-to-many association with Hibernate. Here are the envolved hbm files:



Here are the classes:



Here is the Criteria I'm trying to create:



Here is the output:



I could see that Hibernate is doing a SELECT in the wrong table! The many-to-many table is "PACP_PACOTE_PLANO", and the select is reading from "PACM_PACOTE_MINUTOS"...

What am I doing wrong?
[ September 09, 2005: Message edited by: Wagner da Silva ]
 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, I found a stupid yet simple solution:

First I get a "PlanoFaturamento" object loaded from my DAO, e.g.:



Then I can simply call:



This executes the correct query and gives me a Collection of "PacoteMinutos".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic