-->
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.  [ 2 posts ] 
Author Message
 Post subject: spring 2.0 m4 0406 JpaDaoSupport + hibernate jpa
PostPosted: Fri Apr 07, 2006 11:12 am 
Newbie

Joined: Sun Apr 02, 2006 9:36 am
Posts: 2
spring 2.0 m4 0406 JpaDaoSupport +
hibernate 3.2 rc1+
hibernate-entitymanager-3.1beta7+
hibernate-annotations-3.1beta9

delaying identity-insert due to no transaction in progress why?

It can't persistence object.
[org.springframework.orm.jpa.JpaTemplate] - Creating new EntityManager for JPA template execution
[org.hibernate.impl.SessionImpl] - opened session at timestamp: 4687551353470976
[org.hibernate.event.def.AbstractSaveEventListener] - transient instance of: com.shenghuotag.pst.User
[org.hibernate.event.def.DefaultPersistEventListener] - saving transient instance
[org.hibernate.event.def.AbstractSaveEventListener] - saving [com.shenghuotag.pst.User#<null>]
[org.hibernate.event.def.AbstractSaveEventListener] - delaying identity-insert due to no transaction in progress
[org.springframework.orm.jpa.JpaTemplate] - Closing new EntityManager after JPA template execution
[org.hibernate.impl.SessionImpl] - closing session
[org.hibernate.jdbc.ConnectionManager] - connection already null in cleanup : no action



Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
      <property name="entityManagerName" value="blog" />
   </bean>
   
   <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory" />
      <property name="jpaDialect" ref="jpaDialect" />
   </bean>

    <!-- UserDAO: Hibernate implementation -->
    <bean id="userDAO" class="com.shenghuotag.dao.UserDAO">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
   
</beans>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 9:41 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
This is more of a Spring quesition.

You don't wrap your DAO with any transaction.

Create proxy DAO with jpaTransaction manager as interceptor.
See Spring docs on how to do this.


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

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.