java 持久带_java – 带Spring的EclipseLink – 无法持久存入...

在尝试使用SpringEclipseLink2持久化Derby数据库中的实体时,程序执行无异常,但实体未成功保存。问题可能出在事务处理或者配置上。已检查的配置包括LocalEntityManagerFactoryBean和PersistenceAnnotationBeanPostProcessor。调试跟踪显示事务正常开始、参与并提交,但实体仍未持久化。
摘要由CSDN通过智能技术生成

我使用Spring EclipseLink 2来管理Derby数据库上的实体.从db中选择对象工作正常,但是当我尝试持久化时,没有任何反应.程序正确执行,不会抛出异常.我可能做错了,因为我对Spring不熟悉,感谢您的意见和建议:)

ServerDaoDb方法:

@Transactional

public void addServer(Server server) {

EntityManager em = emf.createEntityManager();

emf.createEntityManager().persist(server);

em.close();

}

应用环境是:

...

class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">

class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

Persistence.xml:

org.eclipse.persistence.jpa.PersistenceProvider

net.athom.spring.examples.models.eas.Server

net.athom.spring.examples.models.eas.Node

调试跟踪:

DEBUG JpaTransactionManager:365 - Creating new transaction with name [net.athom.spring.examples.service.impl.ServerManagerImpl.addServer]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''

[EL Info]: 2010-10-29 15:33:27.443--ServerSession(14894886)--EclipseLink, version: Eclipse Persistence Services - 2.0.2.v20100323-r6872

[EL Info]: 2010-10-29 15:33:28.606--ServerSession(14894886)--file:/C:/netbeanProject/SpringPratique/src/_SpringPratiquePU login successful

15:33:28,893 DEBUG JpaTransactionManager:323 - Opened new EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] for JPA transaction

15:33:28,951 DEBUG DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'transactionManager'

15:33:28,952 DEBUG JpaTransactionManager:286 - Found thread-bound EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] for JPA transaction

15:33:28,953 DEBUG JpaTransactionManager:470 - Participating in existing transaction

15:33:29,266 DEBUG JpaTransactionManager:752 - Initiating transaction commit

15:33:29,267 DEBUG JpaTransactionManager:462 - Committing JPA transaction on EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885]

15:33:29,268 DEBUG JpaTransactionManager:548 - Closing JPA EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] after transaction

15:33:29,308 DEBUG EntityManagerFactoryUtils:328 - Closing JPA EntityManager

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值