• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate: @OneToMany Problem when initialising collection

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I have a really weird issue arising:
By watching at the following code pieces, the relationships build between these classes, Incidencia, ImputacionDocumentoImputable and DocumentoImputable should be right isn't it?


Class Incidencia




Class ImputacionDocumentoImputable



Class DocumentoImputable



The problem arises when Incidencia's metod "getGastoAcumulado()" is called, and accessing the List member 'imputacionDocumentoImputable'. I get an exception like:



The most curious thing is that it used to work, and after a while (and some changes in the application) it is not working properly anymore. The mapping between Incidencia->ImputacionDocumentoImputable<-DocumentoImputable should be fine isn't it? I have such mapping type, and done the same way overall my application and seems to work. The only thing I can figure out might be making the persistence environment to complain is that DocumentoImputable is a base class for some others.

Does anyone happen to know what I am missing?
I am starting to get desperate... can't find a solution.


Thanks in advance,

Carlos.
 
Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found it!, hope nobody missed a second on this!

was a bit reluctant to check the sql thrown by hibernate, but it was the key

one of the tables somehow didn't have the id field. One of the inherited classes were MovtoAlmacen ( another descendant of DocumentoImputable ).

I figured out logging the thrown sql, and running it directly in the database, found the table for the specified table alias (left outer joins) and saw that it was complaining about the "id" field for that table. When I checked, I saw it didn't have an id field.
Added it and it worked.

Regards,
Carlos.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic