- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的应用程序中,我坚持一个具有许多无主子级的实体。
似乎对 persist
的调用实体和所有子项的持久化发生在事务中,因为当我不启用跨组事务时出现错误(并且子项作为父实体生活在不同的实体组中)。
是否有可能以非交易方式进行持久化?
(如果需要此信息:我正在使用 Guice 将请求范围的 Provider<EntityManager>
注入(inject)我的服务对象。)
添加:
这是一个简单的测试用例:
@Entity public class Department {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;
@OneToMany(mappedBy = "department", cascade = CascadeType.ALL)
@Unowned
Collection<Employee> employees = new ArrayList<Employee>();
public Collection<Employee> getEmployees() {
return employees;
}
}
@Entity public class Employee {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne private Department department; private String name;
public Employee(String name) { this.name = name; } public String getName() { return name; }
public void setName(String name) { this.name = name; } }
EntityManager em = EMF.get().createEntityManager();
try {
Department department = new Department();
department.getEmployees().add(new Employee("Joe"));
em.persist(department);
} finally {
em.close();
}
Illegal argument
Caused by:
javax.persistence.PersistenceException: Illegal argument at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:298) at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:197) at com.example.jpa.JpaServlet.doGet(JpaServlet.java:23) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:61) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:409) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: java.lang.IllegalArgumentException: cross-group transaction need to be explicitly specified, see TransactionOptions.Builder.withXGfound both Element { type: "Department" id: 17 } and Element { type: "Employee" id: 18 }
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:33) at com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:70) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:94) at com.google.appengine.api.datastore.FutureHelper$CumulativeAggregateFuture.get(FutureHelper.java:142) at com.google.appengine.api.datastore.FutureHelper$TxnAwareFuture.get(FutureHelper.java:218) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86) at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71) at com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:85) at com.google.appengine.datanucleus.WrappedDatastoreService.put(WrappedDatastoreService.java:112) at com.google.appengine.datanucleus.EntityUtils.putEntitiesIntoDatastore(EntityUtils.java:766) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:314) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2381) at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3778) at org.datanucleus.store.types.sco.SCOUtils.validateObjectForWriting(SCOUtils.java:1518) at com.google.appengine.datanucleus.scostore.AbstractFKStore.validateElementForWriting(AbstractFKStore.java:396) at com.google.appengine.datanucleus.scostore.FKListStore.validateElementForWriting(FKListStore.java:1036) at com.google.appengine.datanucleus.scostore.FKListStore.internalAdd(FKListStore.java:195) at com.google.appengine.datanucleus.scostore.FKListStore.addAll(FKListStore.java:114) at org.datanucleus.store.mapped.mapping.CollectionMapping.postInsert(CollectionMapping.java:134) at com.google.appengine.datanucleus.StoreFieldManager.storeRelations(StoreFieldManager.java:809) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:367) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2381) at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3778) at org.datanucleus.ObjectManagerImpl.flushInternalWithOrdering(ObjectManagerImpl.java:3888) at org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:3811) at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:3751) at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4141) at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428) at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398) at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287) at org.datanucleus.ObjectManagerImpl.close(ObjectManagerImpl.java:1090) at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:193) ... 36 more
Caused by:
java.lang.IllegalArgumentException: cross-group transaction need to be explicitly specified, see TransactionOptions.Builder.withXGfound both Element { type: "Department" id: 17 } and Element { type: "Employee" id: 18 }
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:33) at com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:70) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:94) at com.google.appengine.api.datastore.FutureHelper$CumulativeAggregateFuture.get(FutureHelper.java:142) at com.google.appengine.api.datastore.FutureHelper$TxnAwareFuture.get(FutureHelper.java:218) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86) at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71) at com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32) at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:85) at com.google.appengine.datanucleus.WrappedDatastoreService.put(WrappedDatastoreService.java:112) at com.google.appengine.datanucleus.EntityUtils.putEntitiesIntoDatastore(EntityUtils.java:766) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:314) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2381) at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3778) at org.datanucleus.store.types.sco.SCOUtils.validateObjectForWriting(SCOUtils.java:1518) at com.google.appengine.datanucleus.scostore.AbstractFKStore.validateElementForWriting(AbstractFKStore.java:396) at com.google.appengine.datanucleus.scostore.FKListStore.validateElementForWriting(FKListStore.java:1036) at com.google.appengine.datanucleus.scostore.FKListStore.internalAdd(FKListStore.java:195) at com.google.appengine.datanucleus.scostore.FKListStore.addAll(FKListStore.java:114) at org.datanucleus.store.mapped.mapping.CollectionMapping.postInsert(CollectionMapping.java:134) at com.google.appengine.datanucleus.StoreFieldManager.storeRelations(StoreFieldManager.java:809) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:367) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2381) at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3778) at org.datanucleus.ObjectManagerImpl.flushInternalWithOrdering(ObjectManagerImpl.java:3888) at org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:3811) at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:3751) at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4141) at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428) at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398) at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287) at org.datanucleus.ObjectManagerImpl.close(ObjectManagerImpl.java:1090) at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:193) at com.example.jpa.JpaServlet.doGet(JpaServlet.java:23) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:61) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:409) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
persist
发生在交易中,尽管我没有明确地开始交易。
08:38:17,587 DEBUG [DataNucleus.Persistence] - ================= Persistence Configuration =============== 08:38:17,587 DEBUG [DataNucleus.Persistence] - DataNucleus Persistence Factory - Vendor: "DataNucleus" Version: "3.1.3" 08:38:17,588 DEBUG [DataNucleus.Persistence] - DataNucleus Persistence Factory initialised for datastore URL="appengine" driver="" userName="" 08:38:17,588 DEBUG [DataNucleus.Persistence] - JDK : 1.6.0_26 on Linux 08:38:17,588 DEBUG [DataNucleus.Persistence] - Persistence API : JPA 08:38:17,588 DEBUG [DataNucleus.Persistence] - Plugin Registry : org.datanucleus.plugin.NonManagedPluginRegistry 08:38:17,588 DEBUG [DataNucleus.Persistence] - Persistence-Unit : transactions-optional 08:38:17,588 DEBUG [DataNucleus.Persistence] - Standard Options : pm-singlethreaded, retain-values, nontransactional-read, nontransactional-write, serverTimeZone=UTC 08:38:17,589 DEBUG [DataNucleus.Persistence] - Persistence Options : detach-on-close deletion-policy=JDO2 08:38:17,589 DEBUG [DataNucleus.Persistence] - Transactions : type=RESOURCE_LOCAL mode=optimistic isolation=read-committed 08:38:17,589 DEBUG [DataNucleus.Persistence] - Value Generation : txn-isolation=read-committed connection=New 08:38:17,589 DEBUG [DataNucleus.Persistence] - ClassLoading : jdo 08:38:17,589 DEBUG [DataNucleus.Persistence] - Cache : Level1 (soft), Level2 (soft, mode=UNSPECIFIED), QueryResults (soft), Collections/Maps 08:38:17,589 DEBUG [DataNucleus.Persistence] - =========================================================== 08:38:17,657 DEBUG [DataNucleus.Persistence] - Object Manager "org.datanucleus.ObjectManagerImpl@e4eb585" opened for datastore "com.google.appengine.datanucleus.DatastoreManager@516f3619" with txn="org.datanucleus.TransactionImpl@5c48cd13" 08:38:17,688 DEBUG [DataNucleus.Persistence] - Making object persistent : "com.example.jpa.Department@55b7bf86" 08:38:17,736 DEBUG [DataNucleus.Persistence] - Object "com.example.jpa.Department@55b7bf86" has been marked for persistence but its actual persistence to the datastore will be delayed due to use of optimistic transactions or "delayDatastoreOperationsUntilCommit" 08:38:17,741 DEBUG [DataNucleus.Persistence] - Making object persistent : "com.example.jpa.Employee@95d0a50" 08:38:17,742 DEBUG [DataNucleus.Persistence] - Object "com.example.jpa.Employee@95d0a50" has been marked for persistence but its actual persistence to the datastore will be delayed due to use of optimistic transactions or "delayDatastoreOperationsUntilCommit" 08:38:17,747 DEBUG [DataNucleus.Transaction] - Transaction created [DataNucleus Transaction, ID=Xid= 08:38:17,748 DEBUG [DataNucleus.Transaction] - Transaction begun for ObjectManager org.datanucleus.ObjectManagerImpl@e4eb585 (optimistic=true) 08:38:17,757 DEBUG [DataNucleus.Transaction] - Running enlist operation on resource: com.google.appengine.datanucleus.DatastoreXAResource@7d7082d8, error code TMNOFLAGS and transaction: [DataNucleus Transaction, ID=Xid= 08:38:18,024 DEBUG [DataNucleus.Transaction] - Started datastore transaction: 0 08:38:18,026 DEBUG [DataNucleus.Transaction] - Transaction committing for ObjectManager org.datanucleus.ObjectManagerImpl@e4eb585 08:38:18,027 DEBUG [DataNucleus.Persistence] - ObjectManager.internalFlush() process started using ordered flush - 2 dirty objects 08:38:18,105 DEBUG [DataNucleus.Persistence] - Managing Persistence of Class : com.example.jpa.Employee [Table : com.example.jpa.Employee, InheritanceStrategy : new-table] 08:38:18,136 DEBUG [DataNucleus.Persistence] - Managing Persistence of Class : com.example.jpa.Department [Table : com.example.jpa.Department, InheritanceStrategy : new-table] 08:38:18,316 DEBUG [DataNucleus.Persistence] - Field "com.example.jpa.Department.employees" is being persisted for "cascade-persist". 08:38:18,331 INFO [DataNucleus.Persistence] - Object "com.example.jpa.Department@55b7bf86" has a collection "com.example.jpa.Department.employees" yet element "com.example.jpa.Employee@95d0a50" doesnt have the owner set. Managing the relation and setting the owner. 08:38:18,333 WARN [DataNucleus.MetaData] - Meta-data warning for com.example.jpa.Employee.department: Error in meta-data for com.example.jpa.Employee.department : The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group. The field will be fetched lazily on first access. You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config. A value of NONE will silence the warning. A value of ERROR will turn the warning into an exception. 08:38:18,354 DEBUG [DataNucleus.Persistence] - ObjectManager.internalFlush() process finished 08:38:18,355 DEBUG [DataNucleus.Transaction] - Illegal argument org.datanucleus.exceptions.NucleusFatalUserException: Illegal argument
最佳答案
关于google-app-engine - Google App Engine : When calling persist(. ..) 上的 JPA,它总是发生在事务中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15979389/
我有以下情况要解决,但无法正常工作(尝试了Hibernate和EclipseLink): Table_1: Column_A is Primary Key ... some other
我是 JPA 的新手,但必须在该技术中实现我的项目 我想做的是通过 CriteriaQuery 构建一些数据库查询,但不知道如何将参数列表传递给下面的代码: CriteriaBuilder qb =
我是 JPA 新手,注意到可以通过使用 @Version 注释实体中的字段来使用乐观锁定。我只是好奇,如果之前不存在,持久性提供程序是否会创建一个隐式版本字段。例如网站objectdb状态: "Whe
我有一个 JPA 查询 @Query(value = "SELECT SUM(total_price) FROM ... WHERE ...", nativeQuery = true) 当有匹配的记录
JPA 是否会尝试在已经持久(和非分离)的实体上级联持久化? 为了清楚起见,这是我的情况:我想保留一个新用户: public void addUser(){ //User is an enti
显然,OpenJPA。我也看到提到过 EclipseLink 和 Hibernate,但是在功能上有显着差异吗? 最佳答案 大多数差异来自提供者对 OSGi 的感知程度。例如,您可能需要自己将 Hib
我想将 JPA 用于 micronaut。为此,我使用 io.micronaut.data:micronaut-data-hibernate-jpa:1.0.0.M1 库。每当我运行应用程序并点击端点
我正准备为我的应用实现后端,现在我正在投影数据层。我期待着 Spring 。 最佳答案 Spring Data JPA 不是 JPA 实现。它提供了将数据访问层构建到底层 JPA 顶部的方法。您是否应
假设我有一个表 Item,其中包含一个名为 user_id 的列和一个表 User 以及另一个名为 Superuser 的列: CREATE TABLE Item(id int, user_id in
JPA 2.1 规范说: The entity class must not be final. No methods or persistent instance variables of the
我正在从事一个具有一些不寻常实体关系的项目,我在使用 JPA 时遇到了问题。有两个相关对象;用户,让我们称另一个 X。用户与 X 具有一对多和两个一对一的关系。它基本上看起来像这样 [用户实体] @O
我说的是 JavaEE 中的 JPA。在我读过的一本书中谈到: EntityManager em; em.find(Employee.class, id); “这是实体管理器在数据库中查找实例所需的所
我有 JPA 支持的 Vaadin 应用程序。此应用程序中的组件绑定(bind)到 bean 属性(通过独立的 EL 实现)。一些组件绑定(bind)到外部对象(或其字段),由@OneToOne、@O
是否可以使表中的外键唯一?假设我有实体 A 和 B。 答: @Entity class A extends Serializable { @Id private long id; @OneToOne
我在使用 JPA 时遇到了一点问题。考虑这种情况: 表 A (id_a) | 表 B (id_b, id_a) 我需要的是这样的查询: Select a.*, c.quantity from A as
我有一个由 JPA 管理的实体类,我有一个实体需要在其属性中记录更改。 JPA 是否提供任何方法来处理这种需求? 最佳答案 如果您使用 Hibernate 作为 JPA 提供程序,请查看 Hibern
我想实现以下架构: Table A: a_id (other columns) Table B: b_id (other columns) Table C: c_id (other columns)
我有一个愚蠢的问题。如果能做到的话那就太好了,但我并没有屏住呼吸。 我需要链接到我的 JPA 实体的表中的单个列作为所述 JPA 实体中的集合。有什么方法可以让我单独取回与该实体相关的列,而不必取回整
我有一个 Open JPA 实体,它成功连接了多对多关系。现在我成功地获取了整个表,但我实际上只想要该表中的 ID。我计划稍后调用数据库来重建我需要的实体(根据我的程序流程)。我只需要 ID(或该表中
这是我的一个实体的复合主键。 public class GroupMembershipPK implements Serializable{ private static final long
我是一名优秀的程序员,十分优秀!