Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Search NPE and other id errors

 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic