I don't know if it will help, but from what you say Hibernate Search did its job: it found the entity. Retrieving the entity data and populating the properties (the id in this case) is Hibernate ORM's job. I agree this does not change the fact it doesn't work, but at least it gives us an indication about where to look for the root cause. Now, the fact Hibernate ORM does not do it wrong could stem from all kinds of things: a messed up session, a messed up cache, or simply wrong calls from Hibernate Search... among others. I found this bug, by the way:
HHH-9588 Open . Is your ID getter final? That could explain the issue. Another lead (probably also dead-end, but I'll try anyway): did you check that the entity is actually persisted in database and has the ID you expect? Some weird, unreported error on the database side when persisting the entity would explain a lot, especially if the entity stays in the session between when it's persisted and when you try to search for it. Cheers, Yoann |