[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-599) Hibernate cannot correctly load Locale in a @EmbeddedId key
Smallufo Huang (JIRA)
noreply at atlassian.com
Thu Sep 30 05:22:57 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38559#action_38559 ]
Smallufo Huang commented on HSEARCH-599:
----------------------------------------
I combine "index" and "locale" with a white space in objectToString() , so index=1 , locale=zh_TW is combined to "1 zh_TW" . And in stringToObject() , besides splitting index and locale with whitespace , I should also split "zh_TW" with underline , to build correct language and country (and variant)... , Otherwise , new Locale("zh_TW") will build a lang="zh_tw" locale .
> Hibernate cannot correctly load Locale in a @EmbeddedId key
> -----------------------------------------------------------
>
> Key: HSEARCH-599
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-599
> Project: Hibernate Search
> Issue Type: Bug
> Components: engine
> Affects Versions: 3.2.1
> Environment: hibernate-3.5.6 , hibernate-search-3.2.1 , lucene-2.9.3 , Spring-3.0.4
> Reporter: Smallufo Huang
> Attachments: wrong.gif
>
>
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list