问题标签 [jpa-1.0]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
294 浏览

java - OpenJPA:@OneToMany 与复合主键的映射

We are using OpenJPA 1.2 (aligned with JSR-220 Java Persistence 1.0 specification). We are also evaluating the solution with OpenJPA 2.3 (aligned with JSR-317 Java Persistence 2.0).

For persisting the child we need to call the merge and delete operations on the parent as well as child, which is leading to explicit two calls to the database.

由于 openJPA 不会自动处理这一点,我们正在尝试评估 OpenJPA 是否可以处理这种情况,或者我们是否需要使用 setter 方法显式设置值(即循环遍历子实体的所有实例)。

如果可以推荐任何指针或方向,那么将不胜感激。

谢谢。

0 投票
1 回答
1583 浏览

spring-4 - org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean 升级 spring–orm jar 到 4.1.6 后失败

最初在我们的项目中,我们使用的是 spring 3 + hibernate 3 最近已决定升级 3rd 方 jar,作为 spring 升级到 4 但不是 hibernate 的一部分(仍然保持 hibernate 3)。现在我们没有为 spring 4 升级更改任何代码,当我们执行项目时 LocalContainerEntityManagerFactoryBean 注入失败。我在下面给出了上下文文件声明和错误堆栈跟踪。现在的问题是如何在不升级hibernate的情况下让现有项目在spring 4上运行。

使用 Spring ORM 4.1.6 LocalContainerEntityManagerFactoryBean 正在尝试加载 JPA 2.0 特定的休眠导入(即休眠 4 jar 类)并失败。

错误堆栈跟踪

原因:org.springframework.beans.factory.BeanCreationException:在类路径资源 [applicationContext-securityEJB-DBtest.xml] 中定义名称为“entityManagerFactory”的 bean 创建错误:bean 类型 [class org.springframework.orm] 的后处理失败.jpa.LocalContainerEntityManagerFactoryBean] 失败;嵌套异常是 java.lang.IllegalStateException:无法自省 bean 类 [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] 的持久性元数据:在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory 找不到它依赖的类。 applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:936) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory。