- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在我的 Eclipse 动态 Web 项目中,我使用 JPA。我已经在 TomEE 服务器下的 tomee.xml 中创建了连接,并且工作正常。我创建了一个 persistence.xml 文件,如下所示;但是如果我尝试在 BusinessBean 中添加行 @PersistenceContext(unitName="myPersistence") 我会看到以下错误并且服务器无法启动。如果我尝试在 unitName 下插入随机名称,我也会看到相同的错误。很奇怪,请问如何解决这个问题?谢谢!
我的持久性文件:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="myPersistence">
<jta-data-source>connessioneCorsoWeb</jta-data-source>
<properties>
<property name="openejb.jpa.auto-scan" value="true" />
<!-- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> -->
</properties>
</persistence-unit>
</persistence>
我的错误:
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
AVVERTENZA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:corso_web' did not find a matching property.
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Server version: Apache Tomcat (TomEE)/8.5.32 (7.0.5)
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Server built: Jun 20 2018 19:50:35 UTC
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Server number: 8.5.32.0
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: OS Name: Mac OS X
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: OS Version: 10.13.6
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Architecture: x86_64
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: JVM Version: 1.8.0_20-b26
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: JVM Vendor: Oracle Corporation
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: CATALINA_BASE: /Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: CATALINA_HOME: /Applications/apache-tomee-plume-7.0.5
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Command line argument: -Dcatalina.base=/Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Command line argument: -Dcatalina.home=/Applications/apache-tomee-plume-7.0.5
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Command line argument: -Dwtp.deploy=/Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Command line argument: -Djava.endorsed.dirs=/Applications/apache-tomee-plume-7.0.5/endorsed
Sep 06, 2018 10:47:21 AM sun.reflect.NativeMethodAccessorImpl invoke
INFORMAZIONI: Command line argument: -Dfile.encoding=UTF-8
Sep 06, 2018 10:47:21 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFORMAZIONI: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/test/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
Sep 06, 2018 10:47:22 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFORMAZIONI: Initializing ProtocolHandler ["http-nio-8080"]
Sep 06, 2018 10:47:22 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFORMAZIONI: Using a shared selector for servlet write/read
Sep 06, 2018 10:47:22 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFORMAZIONI: Initializing ProtocolHandler ["ajp-nio-8009"]
Sep 06, 2018 10:47:22 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFORMAZIONI: Using a shared selector for servlet write/read
Sep 06, 2018 10:47:23 AM org.apache.openejb.util.OptionsLog info
INFORMAZIONI: Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: ********************************************************************************
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: OpenEJB http://tomee.apache.org/
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: Startup: Thu Sep 06 10:47:23 CEST 2018
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: Copyright 1999-2018 (C) Apache OpenEJB Project, All Rights Reserved.
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: Version: 7.0.5
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: Build date: 20180710
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: Build time: 12:28
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: ********************************************************************************
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: openejb.home = /Applications/apache-tomee-plume-7.0.5
Sep 06, 2018 10:47:23 AM org.apache.openejb.OpenEJB$Instance <init>
INFORMAZIONI: openejb.base = /Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Sep 06, 2018 10:47:23 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFORMAZIONI: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@8909f18
Sep 06, 2018 10:47:23 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFORMAZIONI: Succeeded in installing singleton service
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory init
INFORMAZIONI: TomEE configuration file is '/Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/openejb.xml'
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.ConfigurationFactory configureService
INFORMAZIONI: Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
Sep 06, 2018 10:47:23 AM org.apache.openejb.config.DeploymentsResolver loadFrom
AVVERTENZA: File error: <Deployments dir="apps/"> - Does not exist: /Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/apps
Sep 06, 2018 10:47:23 AM org.apache.openejb.util.OptionsLog info
INFORMAZIONI: Using 'openejb.deployments.classpath=false'
Sep 06, 2018 10:47:23 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFORMAZIONI: Creating TransactionManager(id=Default Transaction Manager)
Sep 06, 2018 10:47:24 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFORMAZIONI: Creating SecurityService(id=Tomcat Security Service)
Sep 06, 2018 10:47:24 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFORMAZIONI: Creating Resource(id=My DataSource)
Sep 06, 2018 10:47:34 AM org.apache.openejb.config.JndiEncInfoBuilder buildEjbRefs
AVVERTENZA: Unresolved ejb reference "java:comp/env/web.Activator/activeBean" in bean "corso_web.Comp". Will attempt resolution again at runtime.
Sep 06, 2018 10:47:34 AM org.apache.openejb.config.JndiEncInfoBuilder buildEjbRefs
AVVERTENZA: Unresolved ejb reference "java:comp/env/web.Activator/activeBean" in bean "/Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/corso_web". Will attempt resolution again at runtime.
Sep 06, 2018 10:47:34 AM org.apache.openejb.config.ReportValidationResults logResults
GRAVE: FAIL ... corso_web: Use of @PersistenceContext only applies to EntityManager references. Fix ref "java:comp/env/business.PersonaBean/erisci"
Sep 06, 2018 10:47:34 AM org.apache.openejb.config.ReportValidationResults logResults
GRAVE: Invalid EjbModule(name=corso_web, path=/Volumes/Main/Workspace/Learning/JEE2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/corso_web)
Sep 06, 2018 10:47:34 AM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal
GRAVE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso_web]
org.apache.openejb.config.ValidationFailedException: Module failed validation. AppModule(name=corso_web)
at org.apache.openejb.config.ReportValidationResults.deploy(ReportValidationResults.java:88)
at org.apache.openejb.config.AppInfoBuilder.build(AppInfoBuilder.java:327)
at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1040)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Sep 06, 2018 10:47:34 AM sun.reflect.NativeMethodAccessorImpl invoke
GRAVE: ContainerBase.removeChild: destroy:
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso_web]] in state [STARTING_PREP]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:856)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1651)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1631)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1312)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Sep 06, 2018 10:47:34 AM sun.reflect.NativeMethodAccessorImpl invoke
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso_web]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso_web]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
... 6 more
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.config.ValidationFailedException: Module failed validation. AppModule(name=corso_web)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1315)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: org.apache.openejb.config.ValidationFailedException: Module failed validation. AppModule(name=corso_web)
at org.apache.openejb.config.ReportValidationResults.deploy(ReportValidationResults.java:88)
at org.apache.openejb.config.AppInfoBuilder.build(AppInfoBuilder.java:327)
at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1040)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
... 11 more
Sep 06, 2018 10:47:34 AM sun.reflect.NativeMethodAccessorImpl invoke
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:681)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:949)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Sep 06, 2018 10:47:34 AM sun.reflect.NativeMethodAccessorImpl invoke
GRAVE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.startup.Catalina.start(Catalina.java:681)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:949)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
最佳答案
注入(inject)上下文的类型是什么(business.PersonaBean/erisci
)?必须是 EntityManager。如果您需要 EntityManagerFactory,请使用@PersistenceUnit。如果是 EntityManager,则可能意味着您的应用程序打包的 jpa api 与提供的 API 冲突。
关于java - @PersistenceContext(unitName ="myPersistence") 无法启动我的 TomEE Web 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52162359/
我当前在刷新 PersistenceContext 中的数据时遇到问题。我有一个 CMT EJB3 bean,它调用 BMT EJB3 bean。在 BMT bean 中,我对对象执行一些处理逻辑。我
据我了解,交易完成后不会立即刷新。它们位于内存中的缓存中,只有在 EntityManager 确定这样做具有成本效益时才会写入数据库。我相信在这种情况下使用了 L1 缓存,但如果我错了请纠正我。 我的
我创建了一个 PersonDao 对象,它是一个应该使用注入(inject)实体管理器的可注入(inject) bean。问题是 @PersistenceContext() 没有注入(inject)我
根据许多示例,可以像这样将 EntityManager 注入(inject) @Stateless 或 @Singleton EJB: @Stateless // or @Singleton publ
我已经使用多个实体管理器工厂和多个事务管理器定义了多个持久性单元。我知道我可以通过向持久性上下文提供单元名称来访问相应的实体管理器,如下所示。 @PersistenceContext(unitName
我尝试创建 BaseDao 并向其注入(inject) EntityManager。在 Spring 我做了这个: public abstract class BaseJpaDao implement
我正在使用 JPA 2.1,我有这样的东西 public class EntityManagerProducer { @Produces @PersistenceContext(uni
我将 JPA 用于我的应用程序的数据访问层。 我为每个表(实体)都有一个 DAO 类,在每个表中我都通过以下方式获得实体管理器@PersistenceContext 注释。但最近我读到,这意味着我的每
我想这个问题很简单。我不知道该怎么做,我唯一的猜测是: @PersistenceContext("Bibliothouris" + RunParallelized.thread) protected
我正在尝试使用 Delta Spike (@RunWith(CdiTestRunner.class)) 在单元测试中让 CDI(使用 Open Web Beans)工作。依赖注入(inject)工作正
这是我的java类: public class Finder { @PersistenceContext(unitName = "abc") EntityManager em; publi
EntityManager @Inject[ed] 在多个类中是否是线程安全的? @PersistenceContext(unitName="blah") private EntityManager
在几个项目中我已经成功使用 @PersistenceUnit(unitName = "MiddlewareJPA") EntityManagerFactory emf; ... EntityManag
我有两个不同的 EntityManager,我想在其相关 EntityManagerFactory 的遗留类(无 bean) 中使用 @PersistenceContext(name = "entit
基于这个例子: @Service public class Purchase { @PersistenceContext private EntityManager em; @Autowi
我正在使用 Wildfly 创建一个简单的 CRUD 应用程序来管理图书(查找和保留) 但是 EntityManager 总是返回 null。 我尝试了 Persistence.createEntit
我们正在使用 Spring 3.1、JPA(通过 Hibernate)和 Quartz。通常,我们通过 Service bean 上的 @PersistenceContext 注释以及 SpringM
我正在使用 Wildfly 10、Jersey,并使用 @Inject 注入(inject)依赖项。我有 DAO 和 Service 接口(interface),其实现在 CustomBinder 中
我想知道当我调用 session= session.getCurrentSession() 时,hibernate 何时完成上下文 session 问题是我的 dao 中有 2 个方法调用 getCu
尝试通过注释 PersistenceContext 访问 EntityManager 时出现 NullPointerException import javax.ejb.Stateless; impo
我是一名优秀的程序员,十分优秀!