Search Results

Search found 2 results on 1 pages for 'nodje'.

Page 1/1 | 1 

  • Injecting the application TransactionManager into a JPA EntityListener

    - by nodje
    I want to use the JPA EntityListener to support spring security ACLs. On @PostPersist events, I create a permission corresponding to the persisted entity. I need this operation to participate to the current Transaction. For this to happen I need to have a reference to the application TransactionManager in the EntityListener. The problem is, Spring can't manage the EntityListener as it is created automatically when EntityManagerFactory is instantiated. And in a classic Spring app, the EntityManagerFactory is itself created during the TransactioManager instantiation. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> So I have no way to inject the TransactionManager with the constructor, as it is not yet instantiated. Making the EntityManager a @Component create another instance of the EntityManager. Implementing InitiliazingBean and using afterPropertySet() doesn't work as it's not a Spring managed bean. Any idea would be helpful as I'm stuck and out of ideas.

    Read the article

  • from Hibernate hbm to JPA annotations, a challenging one

    - by nodje
    Hi, I've been struggling with this one for quite some time already. It appears a lot less simple than I thought it'd be: This is included in the "COTISATION" table mapping an uses SynchroDataType, extending Hibernate UserType. This works really great, and I can't find a way to translate it to proper JPA, while keeping the convenience of it. Does someone has a solution for that kind of one-to-one mapping? cheers

    Read the article

1