-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Custom Entity persister through JPA (and spring-managed) ?
PostPosted: Mon Aug 11, 2014 12:02 pm 
Newbie

Joined: Mon Aug 11, 2014 11:38 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.