JPA and CAF
Hello,
I try to use JPA to query custom data source, but my persistence.xml is overwriten by CAF, so it will use the system datasource and I will always have the exception like following.
Persistence unit 'XXXXX' requested from archive 'XXXX~caf~ejbmodule.jar' is not present in application 'XXXX~caf~ear' or is not visible to the requested archive. Resolved PU root archive path is 'null', resolved PU name is 'null'.:
Is there any solution to enable multi-persistence unit with CAF?
Regards,
TS
Hi,
there is no chance to use the same persistence.xml as CAF. You cannot prevent CAF from overwriting the persistence.xml.
Ttry another persistence.xml inside another EJB DC and bundle it inside the same EAR.
According to section 7.1.1 "Responsibilities of the Container" in JPA 1.0 specification, JSR 220: Enterprise JavaBeans,Version 3.0, Java Persistence API, more than one jar with META-INF/persistence.xml inside the same EAR should work.
Regards
Rolf
Similar Messages
-
JPA and CAF BO - are there any editors of the JPA data (like CAF)?
Hello!
As you know SAP invented some layer above JPA and called it CAF. There is a very convenient way to edit data in CAF.
But now I have to create a complex database scheme, also with CAF doesn't allow us to work with objects. So we can't use someObject.getChildren().
So my question is are there any editors of the JPA data (like it is done in CAF)?Hi Kirill,
at the beginning of our project at the end of 2009, we did a deep analysis of CAF since our architect vehemently suggested to use this framework.
First about the history and purpose of CAF: Initially, CAF was never meant to be a layer above CAF since CAF was invented in the time before EJB 3.0 and JPA standard where writing persistence with EJB 2.x CMP forced the developer to write pages of boiler plate code. This background was approved by SAP.
With upcoming of JPA, CAF ist mostly useless (except for very simply structured data) and prevents you from writing good software.
It is easy just to write @Entity, @Id and @OneToMany (for complex database schemes) and CAF forces you to use an ugly, imperformant database scheme (e.g. CAF uses mapping tables even for 1:n relationships, a clear antipattern!)
The CRUD-services generated with CAF are a pain, too. Usage of pessimistic locking is not up to date for web applications.
With your complex database schemes, you exceed the limit of CAF.
(We decided not to use CAF and did never regret this.)
Concerning your question: There is an "JPA Details" view in NWDS that might help you. It needs JPA Persistence facet on your project to work. Developed by SAP. For JPA beginners, it is a good cheat sheet for JPA annotations and their attributes.
You do not need more since a JPA POJO is easy to code.
Regards,
Rolf -
Stored procedure, EJB, JPA, and JavaServer Faces
Hi!
I am currently working on a Web application using EJB, JPA, and JavaServer Faces. A part of the
business logic is already stored in the database as stored procedures, so we need to call those
procedures (instead of named queries) through a EJB and represent the data on the web tier.
Where can I find an extensive tutorial using this technology? There is no such tutorial in the Oracle Learning Library.
Maybe somebody can provide a link and/or example.
Thanks in advance for your help!Hi,
http://download.oracle.com/docs/cd/B10464_05/web.904/b10313/queries.htm#1135305
For more help, see the TopLink / JPA forum
TopLink/JPA
Frank -
JPA and SQL Server 2005's Identity Don't Play Nice
I am hoping someone with a little more senior knowledge of JPASQL Server 2005 can point me in the right direction involving SQL Server 2005.
What I am discovering is JPA and SQL Server 2005 do not playing nice together when you use the IDENTITY capability for
a primary key. Let me explain. "...when using the IDENTITY as the generator type, the value for the identity field MAY NOT be
available BEFORE the entity data is saved in the database because typically it is generated when a record is committed."
My problem is this.
I have two separate entities using another entity, for example a car has a wheel and a truck has a wheel. I can go through the steps
of persisting the car and the wheel with no problem. My problem begins when I try to
find the wheel (by wheel description) for the truck. The query finds the wheel, but does not return the primary key for wheel.
Therefore, using the PK inside a query generates this error:
java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation. What has been my appraoch to get the entity to commit to the database is to use the following sequence for the Entity Manager.
entityManager.persist(wheel);
entityManager.flush(); I have assumed to this point this action would persist my data because I have been able to retrieve the PK immidately after these steps.
However, multiple actions taking place within the same transaction, appears to render the persist and flush steps useless. My initial thought
is to wrap the wheel creation within a new transaction so when the method/transaction completes, the data would be in the database. This
has not worked.
I hope I have explained this clear for others to follow. I apologize in advance if I have not. Any suggestions are greatly appreciated.I am hoping someone with a little more senior knowledge of JPASQL Server 2005 can point me in the right direction involving SQL Server 2005.
What I am discovering is JPA and SQL Server 2005 do not playing nice together when you use the IDENTITY capability for
a primary key. Let me explain. "...when using the IDENTITY as the generator type, the value for the identity field MAY NOT be
available BEFORE the entity data is saved in the database because typically it is generated when a record is committed."
My problem is this.
I have two separate entities using another entity, for example a car has a wheel and a truck has a wheel. I can go through the steps
of persisting the car and the wheel with no problem. My problem begins when I try to
find the wheel (by wheel description) for the truck. The query finds the wheel, but does not return the primary key for wheel.
Therefore, using the PK inside a query generates this error:
java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation. What has been my appraoch to get the entity to commit to the database is to use the following sequence for the Entity Manager.
entityManager.persist(wheel);
entityManager.flush(); I have assumed to this point this action would persist my data because I have been able to retrieve the PK immidately after these steps.
However, multiple actions taking place within the same transaction, appears to render the persist and flush steps useless. My initial thought
is to wrap the wheel creation within a new transaction so when the method/transaction completes, the data would be in the database. This
has not worked.
I hope I have explained this clear for others to follow. I apologize in advance if I have not. Any suggestions are greatly appreciated. -
hi ,
How can i represent my DataBase View in JPA , and since each "Entity" should have an "@Id" how can i handle this on my views since some of them does not have a convenient ID field/fields , ThanksIn this situation I created @Id for one of the columns or created @IdClass from all view fields.
-
Web Dynpro and CAF (BOs, Application Services, returning Complex Types)
Hi All,
I am trying to develop an application using Web Dynpro and CAF for days now and did not get it running.. I need some help here.
What I am trying to do / have done is the following:
- Design a Business Object (BO) in CAF
- Implement an Application Service that has a method called getAllBOs that calls the findAll method of the BO
- call this method using AWS model or EJB model in Web Dnypro, show the result in a table.
My getAllBOs returns a set of BOs (Data Type is the Complex Type of my BO in CAF). I was able to design the Application Service so that it returns a collection of BOs (using a Wrapper Comple Type), but I was never able to call the generated Web Service successfully in Web Dynpro. The WebService worked fine when testing it in wsnavigator...
However, i never got it running.. is there anybody out there who is able to explain what to do to import a AWS model or an EJB model in Werb Dynpro and particularily how to implement the stuff so that it returns a set of BOs successfully...
Thanks in advance.. Useful help is highly appreciated
Please note: THIS IS ABOUT Netweaver CE 7.1 - do not post stuff about 7.0!Hi,
You have to return a single object from caf layer to webdynpro layer.
Since you are returning a list of BOs, create a wrapper in caf which contains the list of your BOs.
Your application service should return this wrapper.
Creating Wrapper:
1. Create a complex data type.
2. Include your BO as one of the properties in it. and set the cardinality to 0..n.
In Application service invoke your findAll() of BO and use the returned list to populate the wrapper's BO list.
Return this wrapper.
Hope it helps.
Regards,
Fazal -
Hi All,
How are MDM WF's positioned against BPM and CAF GP in terms of performance, flexibility, capability? Which WF should be preferred over others?
Thanks.
AKHi Abhishek,
If we compare three of them then theBPM/GP would be more powerfull than MDM Workflow because we can design a very complex workflow in BPM/GP that spans accross Systems (Not Only MDM) and customisation can be achived easily in them. MDM workflow are best suited if you are having a simple workflow that spas MDM system only.
BPM is the latest in the market and hve several unique features that are not available in other two. like Automatic Notifications, Dynamic Rules, Graphical Modeling based on BPMN standards.
Hope this helps!!
Cheers,
Arafat -
[NewBie] Not able to connect JPA and Hibernate ?
Hi,
In last few days I have read some tutorial and started doing JPA and Hibernate tutorials. But I am not able to make it work. Can some one please point out what is that I am doing wrong? Here are the details of what I am doing
I am using
IDE : Eclipse EE Indigo
Following jars
antlr-2.7.6.jar
commons-collections-3.2.jar
dom4j-1.6.1.jar
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.1.0.GA.jar
hibernate-entitymanager-3.4.0.GA.jar
hibernate-jpa-2.0-api.jar
hibernate3-3.3.2.GA.jar
javaee-api-5.0-3.jar
javassist-3.9.0.GA.jar
junit-4.8.2.jar
log4j-1.2.12.jar
slf4j-api-1.6.1.jar
slf4j-simple-1.6.1.jar
sqljdbc.jar => For connecting to MS SQL Server database
junit-4.8.2 => For testing the application
The target runtime is set as JBoss 5.0 with jars of JBoss 6.0
Here is my persistence.xml. This file is under "src\META-INF"
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="JH1" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>entity.Users</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=TempEPMUser"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="password"/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="javax.persistence.transactionType" value="RESOURCE_LOCAL"/>
</properties>
</persistence-unit>
</persistence>
Here is the Users.java code. This is the entity class created using the context menu item JPA Entities from tables
package entity;
import java.io.Serializable;
import javax.persistence.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
* The persistent class for the Users database table.
@Entity
public class Users implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="Usr_UserID")
private long usr_UserID;
@Column(name="Usr_DeptId")
private BigDecimal usr_DeptId;
public Users() {
public long getUsr_UserID() {
return this.usr_UserID;
public void setUsr_UserID(long usr_UserID) {
this.usr_UserID = usr_UserID;
Here is the testing code TestUser.java
package testentity;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.PersistenceException;
import org.apache.log4j.BasicConfigurator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import entity.Users;
public class TestUser {
private EntityManagerFactory emf;
private EntityManager em;
@Before
public void initEmfAndEm(){
BasicConfigurator.configure();
try {
emf = Persistence.createEntityManagerFactory("JH1");
} catch (PersistenceException pe) {
System.out.println(pe.getMessage());
em = emf.createEntityManager();
@After
public void cleanup() {
em.close();
@Test
public void emptyTest() {
EntityTransaction et = em.getTransaction();
et.begin();
@SuppressWarnings("unchecked")
final List<Users> listUser = em.createQuery("select usr_DeptID from Users").getResultList();
et.commit();
for (Users usr: listUser){
int depid = usr.getUsr_DeptId().intValue();
System.out.println("User Department id is "+depid);
When I execute the code I get following error message
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:38)
at testentity.TestUser.emptyTest(TestUser.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)Hi,
Try following the JPA tutorials for WebLogic, JPA using EclipseLink or Hibernate will be the same if you stick to the specification. WebLogic 10.3.4.0 ships with a Java EE 6 compliant JPA 2.0 implementation in EclipseLink - you may want to give that a try.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
http://wiki.eclipse.org/EclipseLink/Examples/Distributed
I also have a JBoss 6 tutorial for getting JPA working as well.
BTW, your persistence unit is currently application managed - try switching to container managed - then most of your jar dependencies will go away as everything is already setup for you to do dependency injection via the container.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/JBoss_Web_Tutorial
thank you
Michael O'Brien
http://www.eclipselink.org -
Hi people...
I working with JPA and Hibernate and i have a View in my Database and i need to map this View. It's this possible? Some have an example to show me?.
Thanks!I hope this link help you
http://forums.java.net/jive/message.jspa?messageID=244187
I�m having a similar problem, I�m developing using JPA and now I need to bring values from some views on database but I still don�t know how.I�m still Java jr and I didn�t understand clearly but I guess that the link can help you, and if it�s true please explain me. -
What are the relation between JPA and Hibernate, JPA and TopLink?
What are the relation between JPA and Hibernate, JPA and TopLink?
Can JPA instead of Hibernate and TopLink?The Java Persistence API (JPA) is the object relational mapping persistence
standard for Java. Hibernate and TopLink provide an Open source Object-relational mapping framework for Java.
They provide an implementation for the Java Persistence API. In my opinion, both Hibernate and TopLink provide support to JPA
and they can also be regarded as the complementary to JPA.
Let's wait to see other person's opinions. -
Hi,
What is Guided procedures?
What is CAF?
Why We Can Use GP And CAF?
We Have Webdynpro Why We Go For CAF?
What is RelationShip Between GP AND CAF?
Procedure For Calling BAPI From ECC To CAF In NWDS.
What's use in Guided Procedures And CAF?
THANKS
SUBBARAOGuided Procedures (GP) is a framework for modeling and managing processes that involve access to multiple backend systems. GP enables runtime collaboration and execution of ad-hoc items. In addition, it allows the invocation of various types of applications and services within a process, such as Web Dynpro and BSP applications, RFCs, and so on. The framework implements differentiated role-based access to the available tools in accordance with the useru2019s functions in the enterprise.
GP offers the following features:
Design-time workset
The GP design time offers a set of functions that enables a business expert to create reusable components and model processes with them.
Callable objects are the most fine-grained elements created in the design time. They enable the execution of external applications and services into the GP framework.
Callable objects are attached to actions, which at runtime represent process steps. They are executed in blocks either sequentially, in parallel, or in a loop. Blocks are the main constructs of a process template. At runtime, they represent the process phases.
The GP design time supports data persistency and enables mapping between the parameters of the process building elements. In addition, process role consolidation is possible.
Runtime workset
In the GP runtime, business users can initiate a process from a process template, and follow its execution. Process contributors are guided through the process steps to complete the tasks assigned to them. This process is work item-driven u2013 that is, a contributor acts only when a work item appears in his or her worklist. In addition, a GP process is role-based, as it may involve multiple contributors that have different roles in the enterprise.
The GP runtime offers a set of views that show different aspects of a process.
Interactive forms
The integration of interactive forms into the GP framework enables the implementation of form-based processes. Both online and offline use of forms is supported.
Administration tools
At runtime system administrators can monitor and administer process instances and GP system data using the GP support tool in the SAP NetWeaver Administrator and the administration workset in the portal.
Translation and transport
GP content may be made available in multiple languages using the translation features that the framework provides.
In addition, the GP transport system enables the transfer of GP objects across SAP installations.
Check these..,
wiki
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/dipankar%2bsaha
forums
/thread/40632 [original link is broken]
/thread/107379 [original link is broken]
help docs
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/0034e14db01a85e10000000a422035/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/44/68231834cf4688e10000000a11466f/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/97/08ae42e5adcd6ae10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/44/3bfd6765524903e10000000a1553f7/frameset.htm
Composite Application Framework Weblog Series
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/31389b90-0201-0010-3792-87d3d9421478
Presentation CAF nd GP
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/334de0f2-0c01-0010-6093-9bbacddc488f?prtmode=navigate
pdfs
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/96ed6ea7-0301-0010-b6b2-90d3e54b037e
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1eb928a1-0601-0010-f890-be9169f0d856
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2ae6e722-0701-0010-bdb8-955c90caf32b
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/31389b90-0201-0010-3792-87d3d9421478
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20844e88-0d01-0010-de9a-eb2d302df7b7
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e99cff7a-0601-0010-dea3-e8166c7a7f20
weblog
Additional CAF Training material online
Building ESA and delivering it through CAF
CAF II - Which Tools Does SAP Provide? -
Hi all,
I have some queries regarding the following:
1. What is the use of IAspect?
2. For what purpose IServiceModule is used?
3. Any documentation to learn more about IAspect, IServiceModule and CAF?
Regards
BalaBalachandar,
1. IAspect is an observable "live" list (java.util.List) of business objects. Typically IAspect is returned from IQuery execution, but it may be composed directly via IServiceModule.createAspect(...). Observable means that list uses mechanism of events to notify interested parties (like WD conext nodes) about addition/changing/removal of elements. "Live" means that any such changes are propagated back to middle tier at time of commit (do not remember exactly, IServiceModule.commit() AFAIK). As a result, appending new records causes insertion of records into database, removal of records causes deletion of records from database, etc.
2. IServiceModule is an entry point to functionality exposed by business service. It provides factoy methods to create all necessary queries (IQuery) and object collections (IAspect) as well as functionality to manage transactions (rollback/commit).
3. Tutorials: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1eb928a1-0601-0010-f890-be9169f0d856">Creating Composite Applications</a>, <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/88bcb7c6-0701-0010-8fb7-a6964dd3ee00">Creating a WebDynpro UI for Composite Application</a>
Valery Silaev
EPAM Systems
http://www.NetWeaverTeam.com -
Set role with Java JPA and NativeSQL
Hi,
using 10g setting roles with Java JPA and NativeSQL works fine. After the upgrade to 11g the same commands will not work.
Ars ther any significant changes to set roles in 11g?
Regards
Siegwinsiegwin.port wrote:
using 10g setting roles with Java JPA and NativeSQL works fine. After the upgrade to 11g the same commands will not work.
Ars ther any significant changes to set roles in 11g?When I eval'd 11g, I did not notice any changes in setting my roles. I did notice a significant difference in Java. I cannot remember the JDK version change from 10g to 11g. We ended up settling back to 10g for other reasons. -
OC4J 10.1.3.2, JPA and Hibernate 3.2 Exception on Deployment
I can't get my simple web application to deploy in my standalone oc4j container. The European organization that I working for wants to use the new technologies out there. Part of the testing is getting oc4j working with hibernate. My web application works just fine with Toplink, but not with Hibernate3. The same web application in Tomcat works for both. The error that oc4j generates is shown below and really doesn't say much that I can do. I followed this blog instructions.
http://debupanda.blogspot.com/2007/01/using-hibernate-as-pluggable-ejb-3-jpa.html
2007-04-23 11:48:57.477 NOTIFICATION Starting application : TestJPA
2007-04-23 11:48:57.477 NOTIFICATION Initializing ClassLoader(s)
2007-04-23 11:48:57.477 NOTIFICATION Initializing EJB container
2007-04-23 11:48:57.477 NOTIFICATION Loading connector(s)
2007-04-23 11:48:57.524 NOTIFICATION Starting up resource adapters
2007-04-23 11:48:57.524 NOTIFICATION Initializing EJB sessions
2007-04-23 11:48:57.524 NOTIFICATION Committing ClassLoader(s)
2007-04-23 11:48:57.524 NOTIFICATION Initialize TestJPA begins...
2007-04-23 11:48:57.539 NOTIFICATION Initialize TestJPA ends...
2007-04-23 11:48:57.539 NOTIFICATION Started application : TestJPA
2007-04-23 11:48:57.555 NOTIFICATION Binding web application(s) to site default-
web-site begins...
2007-04-23 11:48:57.571 NOTIFICATION Binding TestJPA web-module for application
TestJPA to site default-web-site under context root jpa
07/04/23 11:48:57 oracle.oc4j.admin.internal.DeployerException: [TestJPA:TestJPA
] - Exception creating EntityManagerFactory using PersistenceProvider class org.
hibernate.ejb.HibernatePersistence for persistence unit TestPU.
07/04/23 11:48:57 at com.evermind.server.ejb.exception.DeploymentException
.exceptionCreatingEntityManagerFactory(DeploymentException.java:130)
07/04/23 11:48:57 at com.evermind.server.ejb.persistence.PersistenceUnitMa
nagerImpl.createContainerEntityManagerFactory(PersistenceUnitManagerImpl.java:19
7)
07/04/23 11:48:57 at com.evermind.server.ejb.persistence.PersistenceUnitMa
nagerImpl.initializePersistenceUnit(PersistenceUnitManagerImpl.java:159)
07/04/23 11:48:57 at com.evermind.server.ejb.persistence.PersistenceUnitMa
nagerImpl.initialize(PersistenceUnitManagerImpl.java:86)
07/04/23 11:48:57 at com.evermind.server.http.HttpApplication.<init>(HttpA
pplication.java:733)
07/04/23 11:48:57 at com.evermind.server.ApplicationStateRunning.getHttpAp
plication(ApplicationStateRunning.java:414)
07/04/23 11:48:57 at com.evermind.server.Application.getHttpApplication(Ap
plication.java:571)
07/04/23 11:48:57 at com.evermind.server.http.HttpSite$HttpApplicationRunT
imeReference.createHttpApplicationFromReference(HttpSite.java:1990)
07/04/23 11:48:57 at com.evermind.server.http.HttpSite$HttpApplicationRunT
imeReference.<init>(HttpSite.java:1909)
07/04/23 11:48:57 at com.evermind.server.http.HttpSite.addHttpApplication(
HttpSite.java:1606)
07/04/23 11:48:57 at oracle.oc4j.admin.internal.WebApplicationBinder.bindW
ebApp(WebApplicationBinder.java:238)
07/04/23 11:48:57 at oracle.oc4j.admin.internal.WebApplicationBinder.bindW
ebApp(WebApplicationBinder.java:99)
07/04/23 11:48:57 at oracle.oc4j.admin.internal.ApplicationDeployer.bindWe
bApp(ApplicationDeployer.java:547)
07/04/23 11:48:57 at oracle.oc4j.admin.internal.ApplicationDeployer.doDepl
oy(ApplicationDeployer.java:202)
07/04/23 11:48:57 at oracle.oc4j.admin.internal.DeployerBase.execute(Deplo
yerBase.java:93)
07/04/23 11:48:57 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeploy
erRunnable.doRun(OC4JDeployerRunnable.java:52)
07/04/23 11:48:57 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRu
nnable.run(DeployerRunnable.java:81)
07/04/23 11:48:57 at com.evermind.util.ReleasableResourcePooledExecutor$My
Worker.run(ReleasableResourcePooledExecutor.java:298)
07/04/23 11:48:57 at java.lang.Thread.run(Unknown Source)
2007-04-23 11:48:57.726 NOTIFICATION Application Deployer for TestJPA FAILED.
2007-04-23 11:48:57.726 NOTIFICATION Application UnDeployer for TestJPA STARTS.
2007-04-23 11:48:57.742 NOTIFICATION Removing all web binding(s) for application
TestJPA from all web site(s)
07/04/23 11:48:57 SEVERE: ProgressObjectImpl.reportError [TestJPA:TestJPA] - Exc
eption creating EntityManagerFactory using PersistenceProvider class org.hiberna
te.ejb.HibernatePersistence for persistence unit TestPU.oracle.oc4j.admin.jmx.sh
ared.exceptions.InternalException: [TestJPA:TestJPA] - Exception creating Entity
ManagerFactory using PersistenceProvider class org.hibernate.ejb.HibernatePersis
tence for persistence unit TestPU.
at oracle.oc4j.admin.jmx.shared.deploy.NotificationUserData.<init>(Notif
icationUserData.java:107)
at oracle.oc4j.admin.internal.Notifier.reportError(Notifier.java:429)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:123
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun
(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(Deplo
yerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
sableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Unknown Source)
Caused by: oracle.oc4j.admin.internal.DeployerException: [TestJPA:TestJPA] - Exc
eption creating EntityManagerFactory using PersistenceProvider class org.hiberna
te.ejb.HibernatePersistence for persistence unit TestPU.
at com.evermind.server.ejb.exception.DeploymentException.exceptionCreati
ngEntityManagerFactory(DeploymentException.java:130)
at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.create
ContainerEntityManagerFactory(PersistenceUnitManagerImpl.java:197)
at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initia
lizePersistenceUnit(PersistenceUnitManagerImpl.java:159)
at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initia
lize(PersistenceUnitManagerImpl.java:86)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:
733)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(Applic
ationStateRunning.java:414)
at com.evermind.server.Application.getHttpApplication(Application.java:5
71)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.cre
ateHttpApplicationFromReference(HttpSite.java:1990)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<in
it>(HttpSite.java:1909)
at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:16
06)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplica
tionBinder.java:238)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplica
tionBinder.java:99)
at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(Application
Deployer.java:547)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDe
ployer.java:202)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
... 4 more
2007-04-23 11:48:58.225 NOTIFICATION Application UnDeployer for TestJPA COMPLETE
S.
07/04/23 11:48:58 WARNING: DeployerRunnable.run [TestJPA:TestJPA] - Exception cr
eating EntityManagerFactory using PersistenceProvider class org.hibernate.ejb.Hi
bernatePersistence for persistence unit TestPU.oracle.oc4j.admin.internal.Deploy
erException: [TestJPA:TestJPA] - Exception creating EntityManagerFactory using P
ersistenceProvider class org.hibernate.ejb.HibernatePersistence for persistence
unit TestPU.
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun
(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(Deplo
yerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
sableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Unknown Source)I am not using JDeveloper, the project was created in Netbeans 5.5. I only use the WAR created and Deploy it using the web administration of Oracle 10.1.3.2
-
Dear experts,
I have a WD application with EJB model. I have faced strange JPA exception (I am using SAP JPA implementation).
This is 2 Entities with relationship
@Entity
@Table( schema = "dbo", name = "class")
public class ClassEntity {
private Long id;
@Id
@Column(name="id")
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
private Collection<ClassAttributeEntity> classAttributesById;
@OneToMany(mappedBy = "classByClassId", fetch=FetchType.LAZY)
public Collection<ClassAttributeEntity> getClassAttributesById() {
return classAttributesById;
public void setClassAttributesById(Collection<ClassAttributeEntity> classAttributesById) {
this.classAttributesById = classAttributesById;
@Entity
@Table( schema = "dbo", name = "class_attribute")
public class ClassAttributeEntity{
private Long id;
@Id
@Column(name="id")
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
private ClassEntity classByClassId;
@ManyToOne
@JoinColumn(name = "class_id", referencedColumnName = "id")
public ClassEntity getClassByClassId() {
return classByClassId;
public void setClassByClassId(ClassEntity classByClassId) {
this.classByClassId = classByClassId;
I want to execute JPQL query
"SELECT c FROM ClassEntity c"
; But I get this exception:
javax.persistence.PersistenceException: The relationship >>classAttributesById<< of entity {test.ClassEntity(id=1686)}cannot be loaded because the entity is detached
I can overcome it using EAGER loading -
@OneToMany(mappedBy = "classByClassId", fetch=FetchType.EAGER)
, but I really dont need ClassAttributes in this situation! I have many thousands of classes and eager loading provides extremly poor perfomance. What can I do with this problem?
Thanks in advance for any advice.Hi Andrey,
I assume you are getting the exception if you atempt to access "classAttributesById" ouside the transaction, in which you executed the query, i.e. after the persistence context, in which the query has been executed is closed.
You have got to make sure that all entities you need to access are read as long as the persistence context executing the query is still open.
How to address this depends a bit on whether you need to access all related entites or only some.
If you need to access the relationship "classAttributesById" for only some instances of "ClassEntity", you could for example call size() on "classAttributesById" for these selected instances of "ClassEntity" (within the same transaction/persistence context".
If you need to access all related entities, theoretically, fetchType = EAGER would be the right choice. However, as you have observed, SAP JPA can't handle this efficiently at the time beeing. Therefore,
I'd rather suggest that you firstly load all related attributes with a query
"SELECT ca FROM ClassAttributeEntity ca"
and secondly load the "ClassEntity"s
"SELECT c FROM ClassEntity c"
this should execute efficiently.
Sorry for the inconvenience.
-Adrian
Maybe you are looking for
-
Cropping video - and exporting to WMV without a border
good morning, I am cropping my videos slightly smaller than the canvas, but when I export them, I get a black border. Is there anyway to get rid of the border? Thanks in advance
-
Xslt transformation - series of tags to unbounded element in target schema
I am fairly new to xslt. I am trying to do this xsl transformation in JDev in my BPEL process. Any pointers to similar samples would help as well. Can you please help me achieve the below: I have a source xml as below: <calloffs> <calloff_dt1>100520<
-
Frequent finder crashes after installing Quicktime & iTunes update
Hi, After installing the updates, I get frequent (~90 seconds) finder crashes. System: 867 Powerbook, 1gb, 80gb Any idea would be greatly appreciated. Rory McMahon
-
Why is Indesign slow on OSX?
Ok so it isn't really slow but it sure feels like that coming from XP. I find the hand tool sluggish in Indesign and Illustrator on super fast macs which is disappointing. Why is this Adobe? And does snow leopard improve things a bit?
-
Hello everyone! Here's my scenario: Multiple IDOCs (of the same message type DEBMAS) may be triggered by a scheduled program (RBDMIDOC). The mapping I created in XI results into individual files being sent to an FTP folder. What I want to happen is f