Announcement Announcement Module
No announcement yet.
entity manager under Hibernate 4.1.11.Final release Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • entity manager under Hibernate 4.1.11.Final release

    Having trouble to use Spring injects Hibernate 4.1.11.Final release's EntityManager implementation,
    while it was fine integrated with Hibernate version 4.1.7.Final release.

    The trouble seems that Spring doesn't inject 4.1.11.Final version Hibernate's EntityManager properly.
    The versions we are using:
    hibernate - 4.1.11.Final
    spring jpa - 1.3.0.RELEASE
    spring - 3.2.2.RELEASE
    spring aspectj - 1.7.2

    The config snippets as :

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
    <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">

    <bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.Hibernat eJpaDialect" />

    <bean id="sharedEntityManagerBean" class=" ntityManagerBean">
    <property name="entityManagerFactory" ref="entityManagerFactory" />

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    <property name="jpaDialect" ref="jpaDialect" />
    <property name="nestedTransactionAllowed" value="true" />

    In the entity class:
    public class SomeDocuments {
    @PersistenceContext transient EntityManager entityManager;
    @Lob private Blob data;
    public void setData(InputStream data) throws IOException {

    // entityManager works fine with Hirbernate 4.1.7.Final release version

    // entityManager is null with Hibernate 4.1.11.Final release

    Session session = (Session)entityManager.getDelegate();
    LobCreator lobCreator = Hibernate.getLobCreator(session);, 0);

    Any suggestions to work around this issue will be very appreciated!