Hi all,
On my current project, we created an hibernate custom entity persister and everything works fine with the @Persister annotation on the entities:
Code:
@Entity
@Persister(impl = MyPersister.class)
public class MyEntity {
@Id
private int id;
@Column
private int value;
}
However, with this setup, MyPersister is being instantiated by Hibernate and thus I can't have it spring-managed. Is there any way to set this up so that the custom persister is created by spring? I currently go around this by injecting the properties into another spring bean and setting them on MyPersister's static method. This way, whatever MyPersister instance hibernate creates will have the properties. It would be much nicer if I could inject directly in MyPersister...
Also, I would like to keep my custom persister in a distinct project, wheras the entity would not have a direct dependance on the persister. Is there a way to define the custom persister through JPA xml ? (I know it can be done through hbm.xml, but my configuration is done through JPA/persistence.xml/orm.xml)
Any hint, ideas or possible solutions would be welcome.
Thanks in advance
Alex