[hibernate-users] Hibernate Search + Bridges + Spring

Alexander Rosemann alexander.rosemann at gmail.com
Wed Nov 25 08:06:07 EST 2009


Hi,

I'm currently stuck trying to use a Spring Bean as a FieldBridge.
I have a persisted Class A which has a property of type String. The 
String represents a comma separated list of IDs which relate to Class B.

class A {
   @Field
   @FieldBridge(impl=BFieldBridge.class)
   String bIds;
}

class B {
  String name;
}



I have a Spring service that is able to resolve the comma separated list 
of IDs into objects. I tried injecting the service into my FieldBridge 
which dosen't work since the FieldBridge class gets created by Hibernate 
Search rather than Spring.
I would love to reuse the service in my FieldBridge rather than 
duplicating my code...

Did anybody tried to do something similar and has some suggestions/ 
pointers for me on how this can be achieved?

I'm using Hibernate 3.2.6.ga, Hibernate-Annotations 3.3.1.GA, Hibernate 
Search 3.0.1.GA, Spring 2.0.5.

Thanks,
Alex


More information about the hibernate-users mailing list