[hibernate-issues] [Hibernate-JIRA] Updated: (HSEARCH-1050) DocumentId ignored in case of EmbeddedId
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Tue Feb 28 11:52:50 EST 2012
[ https://hibernate.onjira.com/browse/HSEARCH-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bernard updated HSEARCH-1050:
--------------------------------------
Fix Version/s: (was: 4.1.0.CR1)
> DocumentId ignored in case of EmbeddedId
> ----------------------------------------
>
> Key: HSEARCH-1050
> URL: https://hibernate.onjira.com/browse/HSEARCH-1050
> Project: Hibernate Search
> Issue Type: Bug
> Components: engine
> Affects Versions: 4.0.0.Final, 4.1.0.Beta2
> Reporter: Marc Schipperheyn
> Assignee: Sanne Grinovero
> Priority: Critical
>
> When a class contains both a @DocumentId and an @EmbeddedId set at different fields, Hibernate Search should use the DocumentId field.
> However, I'm noticing in 4.1.0Beta2 that in this case, the EmbeddedId field is used. In my case this leads to a
> org.hibernate.search.bridge.BridgeException: Exception while calling bridge#objectToString
> class: nl.project.model.NetworkCandidateLink
> field bridge: id
> at org.hibernate.search.bridge.util.impl.ContextualExceptionBridge.buildBridgeException(ContextualExceptionBridge.java:78)
> at org.hibernate.search.bridge.util.impl.ContextualException2WayBridge.objectToString(ContextualException2WayBridge.java:84)
> at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:164)
> at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:134)
> at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:105)
> at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ClassCastException: nl.project.model.NetworkCandidateLinkId cannot be cast to java.lang.String
> at org.hibernate.search.bridge.builtin.StringBridge.objectToString(StringBridge.java:39)
> at org.hibernate.search.bridge.builtin.impl.TwoWayString2FieldBridgeAdaptor.objectToString(TwoWayString2FieldBridgeAdaptor.java:48)
> at org.hibernate.search.bridge.util.impl.ContextualException2WayBridge.objectToString(ContextualException2WayBridge.java:77)
> ... 7 more
> I'm failry certain this was working correctly in 3.x
> The class configuration is as follows:
> @Entity
> @Table
> @AssociationOverrides({
> @AssociationOverride(name = "pk.network",
> joinColumns = @JoinColumn(name = "nwId")),
> @AssociationOverride(name = "pk.candidate",
> joinColumns = @JoinColumn(name = "cId"))
> })
> @Indexed
> public class NetworkCandidateLink implements Serializable{
> private NetworkCandidateLinkId pk = new NetworkCandidateLinkId();
> @EmbeddedId
> public NetworkCandidateLinkId getPk() {
> return pk;
> }
> public void setPk(NetworkCandidateLinkId pk) {
> this.pk = pk;
> }
> @DocumentId
> @Transient
> public String getId(){
> return pk.getCandidate().getId() + "_" + pk.getNetwork().getId();
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list