• 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 Search NPE and other id errors

 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have object A, which is an abstract class. It has concrete implementations A1, A2, etc. They are all mapped using the same hbm.xml file, with each class using separate tables.

I'm trying to implement Hibernate Search. I added @Indexed and @DocumentId to A1, A2, etc, but not A. A does have an id, which ends up being the same as the ones for the subclasses.

Whenever I run my program, I get errors about the id being null. This is without calling anything specific to the search. I'm not sure why it can't find the id of the object.




If I actually try and do a search, I get the following error. ContextUtil is a context listener and I'm just using it to make sure my test code runs at server startup.


It seems that the translation from the lucene query to the hibernate one isn't properly mapping the fields.


Any help would be appreciated.

TIA.
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I fixed the search error. I had to move the @DocumentId tag from the concrete subclasses to the abstract superclass.

But I'm still getting the NPE whenever I do anything with the database. Any ideas why?
 
I am Arthur, King of the Britons. And this is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic