[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-599) Hibernate cannot correctly load Locale in a @EmbeddedId key

Sanne Grinovero (JIRA) noreply at atlassian.com
Thu Sep 30 02:32:57 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38554#action_38554 ] 

Sanne Grinovero commented on HSEARCH-599:
-----------------------------------------

the Locale is loaded by your fieldBridge: NameKeyBridge's implementation should care for this. Is it a TwoWayFieldBridge? if yes, it's creating the locale starting from the encoded locale String, if not it should have thrown an exception as fields marked as identifiers should be twoway.

> 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