Rejected
Details
Assignee
UnassignedUnassignedReporter
Smallufo HuangSmallufo HuangComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Smallufo Huang
Smallufo HuangComponents
Affects versions
Priority
Created September 30, 2010 at 3:57 AM
Updated September 11, 2011 at 6:20 PM
Resolved September 30, 2010 at 11:12 AM
The whole description (with pretty code formatting) is in this thread : http://stackoverflow.com/questions/3825729/hibernate-search-unable-to-load-entities-with-composite-primary-keys
To make it clear , I found an @EmbeddedId cannot correctly load Locale property!
Suppose I have an @EmbeddedId with an integer and a locale , composing a composite primary key.
And if the locale column in DB is storing "zh_TW" , it should build a Locale("zh" , "TW") object , with language=zh , country=Taiwan.
But the loaded locale is language="zh_tw" , without country value! It will invalidate the equals()/hashCode() contract.
And lucene will log "Object found in Search index but not in database" !
But if I remove the @EmbeddedId and use a surrogate key , the locale can be loaded correctly !
So it is a bug , but I am not sure it is from hibernate or hibernate-search.