[Hibernate-JIRA] Created: (HSEARCH-979) Programmatic API: mapping a composite primary key
by Fuessmann (JIRA)
Programmatic API: mapping a composite primary key
-------------------------------------------------
Key: HSEARCH-979
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-979
Project: Hibernate Search
Issue Type: Bug
Components: mapping
Affects Versions: 3.4.1.Final, 3.3.0.Final
Environment: Hibernate 3.6 Final
Reporter: Fuessmann
Hallo, I'm using Hibernate Search in combination with the [b]Programmatic API[/b] for dynamic indexing. Is there any possibility to index an entity with an composite primary key annotated with [b]@EmbeddedId[/b]. Using H.Search without the Programmatic API i choose a TwoWayFieldBridge but how can I use it with the Programmatic API?
In my case I am trying to implement a programmatic mapping for an entity. The entity has an an composite primary key annotated with @EmbeddedId.
{quote}
...
@Entity(name = "a")
@Table(name = "a")
public class A implements java.io.Serializable {
...
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "name_1", column = @Column(name = "name_1", nullable = false, length = 64)),
@AttributeOverride(name = "name_2", column = @Column(name = "name_2", nullable = false, length = 16)) })
public AId getId() {
return this.id;
...
}
{quote}
Code for ABridge.class is not shown but still exists ..
I try a code like this, but the code does not work:
{quote}
mapping.entity(A.class).indexed().indexName("a")
.property("id", ElementType.METHOD).documentId().field().bridge(ABridge.class)
{quote}
Exception occurred during event dispatching:
{quote}
org.hibernate.HibernateException: [color=#FF0000]could not init listeners{color}
...
Caused by: org.hibernate.search.SearchException: {color:red} Unable to guess FieldBridge for id{color}
...
{quote}
I need an advise to solve my problem. Thanks
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months