- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有一个现有的应用程序,一切正常。但是由于种种原因,我不得不从sessionFactory "org.springframework.orm.hibernate3.LocalSessionFactoryBean"
切换到entityManagerFactory "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
。现在,我在org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance server.model.instance.ComponentInstance
处得到一个junit-integration.Test
。
经过五六个小时的毫无结果的谷歌搜索后,我决定在这里写下我的问题。我将很感激,这将对您有所帮助。
这是junit测试代码,以及在堆栈跟踪中提到的代码:
public void deleteComponentInstance ( ComponentInstance instanceToDelete ) {
setComponentInstanceForeignKeyToNull ( instanceToDelete );
deleteAndFlush ( instanceToDelete );
}
public <P> void deleteAndFlush ( P persistentObject ) {
Session session = sessionFactory.getCurrentSession ();
session.delete ( persistentObject );
session.flush ();
}
public void setComponentInstanceForeignKeyToNull ( Class<?> clazz, String attribute, Object value ) {
StringBuilder hqlQuery = new StringBuilder ()
.append ( "update " )
.append ( clazz.getSimpleName () )
.append ( " entity set entity." ).append ( attribute )
.append ( " = null where entity." ).append ( attribute )
.append ( " = :actualValue" );
Session currentSession = this.sessionFactory.getCurrentSession ();
currentSession.createQuery ( hqlQuery.toString () )
.setEntity ( "actualValue", value )
.executeUpdate ();
}
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="spring-jpa" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="database" value="HSQL" />
</bean>
</property>
</bean>
<bean id="sessionFactory" factory-bean="entityManagerFactory" factory-method="getSessionFactory" />
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations" ref="hibernateMappingFiles" />
<property name="hibernateProperties" ref="hibernateProperties" />
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
<persistence-unit name="spring-jpa">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.hbm2ddl.auto" value="none" />
<property name="javax.persistence.validation.mode" value="none" />
<property name="hibernate.jdbc.use_streams_for_binary"
value="true" />
<property name="hibernate.jdbc.fetch_size" value="100" />
<property name="hibernate.current_session_context_class" value="org.springframework.orm.hibernate3.SpringSessionContext" />
</properties>
2011-11-30 09:41:01,890 [org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean#4929b0e1-1] INFO server.interpreter.ast.ExecNativeOperator:893 - ExecNativeOperator SuccessCriteria RC satisfied
2011-11-30 09:41:01,890 [org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean#4929b0e1-1] INFO server.interpreter.ast.ExecNativeOperator:481 - ExecNativeOperator executeProcess() finished successfully.
2011-11-30 09:41:01,900 [org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean#4929b0e1-1] INFO server.locking.DeadlockDetectionLock:324 - Successfully released EXCLUSIVE server.locking.DeadlockDetectionLock@511ee8dd.
2011-11-30 09:41:01,924 [org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean#4929b0e1-1] ERROR server.interpreter.step.StepTemplate:162 - Interpreter step aborted.
org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]; nested exception is java.lang.IllegalArgumentException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:291)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:125)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy65.deleteAndFlush(Unknown Source)
at server.component.control.impl.ComponentInstanceServiceImpl.deleteComponentInstance(ComponentInstanceServiceImpl.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy93.deleteComponentInstance(Unknown Source)
at server.interpreter.ast.UninstallOperator$2.evaluateStep(UninstallOperator.java:143)
at server.interpreter.ast.UninstallOperator$2.evaluateStep(UninstallOperator.java:1)
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:133)
at server.interpreter.step.StepTemplate.protocolStep(StepTemplate.java:86)
at server.interpreter.ast.UninstallOperator.doEvaluate(UninstallOperator.java:152)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.SemicolonOperator.doEvaluate(SemicolonOperator.java:42)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.BlockOperator.doEvaluate(BlockOperator.java:41)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.ast.IfOperator$3.evaluateStep(IfOperator.java:128)
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:133)
at server.interpreter.step.StepTemplate.protocolStep(StepTemplate.java:86)
at server.interpreter.ast.IfOperator.evaluateAndProtocolBlock(IfOperator.java:131)
at server.interpreter.ast.IfOperator.access$2(IfOperator.java:119)
at server.interpreter.ast.IfOperator$2.evaluateStep(IfOperator.java:68)
at server.interpreter.ast.IfOperator$2.evaluateStep(IfOperator.java:1)
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:133)
at server.interpreter.step.StepTemplate.protocolStep(StepTemplate.java:86)
at server.interpreter.ast.IfOperator.doEvaluate(IfOperator.java:76)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.security.SecurityContextInheritingCallable.call(SecurityContextInheritingCallable.java:47)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]
at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:65)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:108)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:948)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:926)
at server.dao.hibernate.HibernateGenericDao.deleteAndFlush(HibernateGenericDao.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
... 78 more
2 011-11-30 09:41:01,951 [org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean#4929b0e1-1] WARN server.interpreter.step.StepTemplate:154 - Interpreter step aborted.
server.process.control.StepAbortionAlreadyProtocolledException: org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]; nested exception is java.lang.IllegalArgumentException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:164)
at server.interpreter.ast.IfOperator.doEvaluate(IfOperator.java:76)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.SemicolonOperator.doEvaluate(SemicolonOperator.java:42)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.SemicolonOperator.doEvaluate(SemicolonOperator.java:43)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.SemicolonOperator.doEvaluate(SemicolonOperator.java:43)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.BlockOperator.doEvaluate(BlockOperator.java:41)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.ast.HostLockingOperator$2$2.doWhileLocked(HostLockingOperator.java:210)
at server.host.control.impl.HostLockingServiceImpl$1.doWhileLocked(HostLockingServiceImpl.java:161)
at server.host.control.impl.HostLockingServiceImpl.doLockAndExecute(HostLockingServiceImpl.java:199)
at server.host.control.impl.HostLockingServiceImpl.lockAndExecute(HostLockingServiceImpl.java:148)
at server.interpreter.ast.HostLockingOperator$2.evaluateStep(HostLockingOperator.java:199)
at server.interpreter.ast.HostLockingOperator$2.evaluateStep(HostLockingOperator.java:1)
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:133)
at server.interpreter.step.StepTemplate.protocolStep(StepTemplate.java:86)
at server.interpreter.ast.HostLockingOperator.doEvaluate(HostLockingOperator.java:229)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.AbstractEvaluable.nullSafeEvaluate(AbstractEvaluable.java:123)
at server.interpreter.ast.MethodReturnOperator.doEvaluate(MethodReturnOperator.java:44)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.interpreter.ast.PlanOperator.doEvaluate(PlanOperator.java:54)
at server.interpreter.AbstractEvaluable.evaluate(AbstractEvaluable.java:57)
at server.model.boundary.impl.ModelExecutionServiceImpl$6.doExecute(ModelExecutionServiceImpl.java:483)
at server.job.control.ProtocolSubJob.execute(ProtocolSubJob.java:86)
at server.job.control.impl.JobExecutorServiceImpl$JobCallable.call(JobExecutorServiceImpl.java:497)
at server.job.control.impl.JobExecutorServiceImpl$2.call(JobExecutorServiceImpl.java:249)
at server.security.SecurityContextInheritingCallable.call(SecurityContextInheritingCallable.java:47)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]; nested exception is java.lang.IllegalArgumentException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:291)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:125)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy65.deleteAndFlush(Unknown Source)
at server.component.control.impl.ComponentInstanceServiceImpl.deleteComponentInstance(ComponentInstanceServiceImpl.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy93.deleteComponentInstance(Unknown Source)
at server.interpreter.ast.UninstallOperator$2.evaluateStep(UninstallOperator.java:143)
at server.interpreter.ast.UninstallOperator$2.evaluateStep(UninstallOperator.java:1)
at server.interpreter.step.StepTemplate$StepExceptionHandler.performProtectedAction(StepTemplate.java:133)
... 60 more
Caused by: java.lang.IllegalArgumentException: Removing a detached instance server.model.instance.ComponentInstance#ComponentInstanceId[id=140]
at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:65)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:108)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:948)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:926)
at server.dao.hibernate.HibernateGenericDao.deleteAndFlush(HibernateGenericDao.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
... 78 more
最佳答案
看起来您错过了JPA的事务配置,它看起来应该与旧的相似:
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
关于hibernate - 从sessionFactory切换到EntityManager后,InvalidDataAccessApiUsageException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8324562/
有一些使用多个数据源的示例: @Inject @DataSource("users") AgroalDataSource dataSource1; @Inject @DataSource("inven
我试图使用持久性和 servlet guice 扩展,让简单的 webapp 在 Jetty 上与 Guice 和 JPA 一起工作。 我写了这个服务实现类: public class PersonS
我使用 Hibernate 5.1.0.Final、Guice、Jersey。我有创建 EntityManagerFactory 的 HibernateModule并管理EntityManager实例
我正在使用 ThreadLocal 和请求/实体模式来获取实体。这种情况发生时,我关闭了一个实体管理器,并且在后台有一些实体可以编辑、复制和修改,然后我想将其保留或与新的实体管理器合并。我不知道这是一
好的,我正在使用 EJB 3.0 和 hibernate,我们将 .ear 文件放入嵌入 Apache Tomcat 6.0.18 的 Easy-Beans 1.0.1(带有 Hibernate)部署
我正在使用 Spring + JPA + Hibernate + EntityManager 与数据库对话。我收到“A JTA EntityManager cannot use getTransact
更新数据库时我应该更喜欢什么?这两种方法的优缺点是什么?我什么时候应该使用其中一种? public void disemployEmployee(Integer employeeId, Date en
我正在尝试在存储库中注入(inject) EntityManager。 编译成功,但是当我运行应用程序并发送一个发布请求时,我收到了这个错误: Unexpected error occurred: F
我正在尝试在 Spring Tools Suite 和 Pivotal tc Server Developer Edition 上开发 Spring+Hibernate+EntityManager+S
我有一个使用 spring boot + spring data JPA 的示例项目。在日志中,我观察到 EntityManagers 在我进行第一次 rest 调用之前被创建了几次。请澄清为什么会发
给定网络应用程序中的以下情况: // EntityManager em, one per Request with Spring's OpenEntityManagerInViewFilter //
当我们在 JAVA EE 环境中的 EntityManager 上使用 @PersistenceContext 注释时,容器将创建 entityManagerFactory(我猜是整个 session
我遇到了一种情况(我认为这很奇怪,但可能很正常),我使用 EntityManager.getReference(LObj.getClass(), LObj.getId()) 来获取数据库实体,然后通过
我有以下服务... @Stateless @LocalBean public class RandomService { @EJB RandomString stringTokenizer;
我在实体类中有这个函数,但 getDoctrine 不喜欢...... public function getObject() { $em = $this->getDoctrine()->ge
我正在尝试以级联方式保存某个对象并检索它。 我有 3 个对象超过 3 个实体。 实体: class Order { /** * @var integer $id *
我正在开发一个 JPA 应用程序(使用 hibernate ),我正在与 作斗争。自动冲洗 特征。 默认情况下,每当我们处理对任何实体的查询时,完整的 实体管理器 被冲洗。在大多数情况下这是可以的:我
我刚刚建立了一个到目前为止仍然非常小的项目 maven/jpa/hibernate 项目,我试图在其中持久化一个对象。 我的类(class)是一个非常简单的类(class): @Entity publ
我当前的项目使用 HSQLDB2.0 和 JPA2.0 。 场景是:我查询数据库以获取 contactDetails 的列表的 person .我删单contactInfo在 UI 中,但不保存该数据
我是 jpa 和 spring 世界的新手,我目前正在对一个简单的方法进行一些单元测试,但只有当我在单元测试模式下运行我的测试类时才会继续收到此错误消息: java.lang.IllegalState
我是一名优秀的程序员,十分优秀!