JPA, java persistence Api, troubleshooting

Hi everybody.
I have a small but boring problem.
I am new at Netbeans and Java Sdk.
I downloaded Netbeans 6.1 and SDK 6.
I tried to exercise "simple database application" in the netbeans web page.
A error encountered that:
24.Tem.2008 10:04:16 org.jdesktop.application.Application$1 run
SEVERE: Application class simpleAp.simpleAp failed to launch
*javax.persistence.PersistenceException: No Persistence provider for EntityManager named simpleAppPU*: The following providers:
oracle.toplink.essentials.PersistenceProvider
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
Returned null to createEntityManagerFactory.
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
I can't fix this. anybody know the solution??
hanks, good work.

Assalamu Alaikum,
Check in persistence.xml whether persistence-unit is same in Persistence.createEntityManagerFactory*("simpleAppPU")* or not. It should be same.
persistence.xml is like as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="*simpleAppPU*" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<class>Users</class>
<properties>
<property name="toplink.jdbc.user" value="root"/>
<property name="toplink.jdbc.password" value="password"/>
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/innosched"/>
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
</properties>
</persistence-unit>
</persistence>

Similar Messages

  • DAO pattern and Java Persistence API

    Hi
    This is a question for anyone who might be familiar with the standard DAO design pattern and the Java Persistence API (JPA - part of EJB3). I'm new to this technology, so apologies for any terminology aberrations.
    I am developing the overall architecture for an enterprise system. I intend to use the DAO pattern as the conceptual basis for all data access - this data will reside in a number of forms (e.g. RDBMS, flat file). In the specific case of the RDBMS, I intend to use JPA. My understanding of JPA is that it does/can support the DAO concept, but I'm struggling to get my head around how the two ideas (can be made to) relate to each other.
    For example, the DAO pattern is all about how business objects, data access objects, data transfer objects, data sources, etc relate to each other; JPA is all about entities and persistence units/contexts relate to each other. Further, JPA uses ORM, which is not a DAO concept.
    So, to summarise - can DAO and JPA work together and if so how?
    Thanks
    P.S. Please let me know if you think this topic would be more visible in another forum (e.g. EJB).

    Thanks, duffymo, that makes sense. However ... having read through numerous threads in which you voice your opinion of the DAO World According to Sun, I'd be interested to know your thoughts on the following ...
    Basically, I'm in the process of proposing an enterprise system architecture, which will use DAO as the primary persistence abstraction, and DAO + JPA in the particular case of persistence to a RDBMS. In doing so, I'd like to illustrate the various elements of the DAO pattern, a la the standard class diagram that relates BusinessObject / DataAccessObject / DataSource / TransferObject (http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html). With reference to this model, I know that you have a view on the concept of TransferObject (aka ValueObject?) - how would you depict the DAO pattern in its most generic form? Or is the concept of a generic DAO pattern compromised by the specific implementation that is used (in this case JPA)?

  • Java Persistence API and creation of databases

    Hi All
    I have designed a small address book application which uses a database to store the information. I have used the new Java Persistence API to take care of my transactions and querrys with the database. This works great for one set database which is generated the first time the application runs and is used all the time.
    However I would like to make it so that the user can create a new address book (database) with a different name, I am not sure how I would do this using the Java Persistence API. I know the persistence.xml file must be placed in the META-INF directory of the source, so how would I be able manipulate the file or could I place the file somewhere else.
    David

    I am using the Derby database. I can create a database by passing the create command when I create the entity Manager like so:
    Connection c = DriverManager.getConnection("jdbc:derby:AddressBook;create=true", "app", "app");My problem is that as I understand it the persistence.xml file must know the name of the database. Unless there is another way of setting this. The line in the persistence file I am referring to is:
    <property name="toplink.jdbc.url" value="jdbc:derby:AddressBook"/>I wonder if I can progamatically set this value so that I have a default database in the persistence.xml and others can then create there own.
    David

  • Newbie question on Java Persistence API - Entity Beans

    Hi All,
    I am basically new to Entities and the Java Persistence API. My question is, when using a container managed EntityManager, do I have to manually tidy-up any resources? Say for example, do I have to explicitly close the database connection (if ever I have that ability)? Invoke close() on EntityManager?
    - Pat

    You don't have to. That's what they mean by container managed. The container does it for you.
    In fact you will get an IllegalStateException if you call close on a container-managed EntityManager.

  • Question about Java Persistence API.

    is Java Persistence API a Object-Relational Mapping Framework, or the java Programmer can use this API to do mapping between Java Applicatiion and Relational Database ??

    http://java.sun.com/javaee/overview/faq/persistence.jsp

  • Java persistence api : ejb ql

    Hi,
    I am using java persistence api(over oracle toplinks)
    I have an entity customer and another entity contacts.
    customer is mapped with contact as one to many.
    the contact have a field primarycontact.
    I want to get the contact name from contacts for a customer where primarycontact field is true. and set this contact name as a field customercontact which is a string in customer..
    I got a way by executing multiple queries.
    but is it possible to do this in single query using ejb ql?
    Any help will be greatly appreciated..
    Thanks in advance....

    @Id
    @GeneratedValue( @GeneratedValue(strategy= GenerationType.TABLE, generator="SOMENAME")
    public int setId() {
    returrn this.id;
    in the database you need to create table using following commands
    CREATE TABLE SEQUENCE
    SEQ_NAME VARCHAR(50),
    SEQ_COUNT DECIMAL(15)
    and insert a row initally with the same "SOMENAME" like
    insert into sequence values ( "SOMENAME", 1);
    you can get the next id by adding 50(default) to "SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = "SOMENAME"
    hope this provides a solution.

  • Java persistence API

    Hi! I am trying to learn to use the http://www.devx.com/Java/Article/33650/ api manually, i tried using netbeans 6.0 for it but i'm not very sure what it does so i am going to try it manually now. I've read these 2 articles by Antonio Goncalves
    (http://www.devx.com/Java/Article/33650/ && http://www.devx.com/Java/Article/33906/) it doesn't look very difficult at first but the thing is in netbeans 6.0 when i try to use the annotations,@Inheritance for example, It autocompletes but i don't see the javadoc it says ("Javadoc not found"). I already added the javaee5 documentation to the javaplataform manager but it doesn't do the trick.
    Anybody can help? Also if you know any kind of tutorial for the persistence api if you could point me towards there it would be nice.
    And finally sorry if i have misplaced this post, I couldn't find a better place.
    Thanks, Joaquin

    Hi! I am trying to learn to use the http://www.devx.com/Java/Article/33650/ api manually, i tried using netbeans 6.0 for it but i'm not very sure what it does so i am going to try it manually now. I've read these 2 articles by Antonio Goncalves
    (http://www.devx.com/Java/Article/33650/ && http://www.devx.com/Java/Article/33906/) it doesn't look very difficult at first but the thing is in netbeans 6.0 when i try to use the annotations,@Inheritance for example, It autocompletes but i don't see the javadoc it says ("Javadoc not found"). I already added the javaee5 documentation to the javaplataform manager but it doesn't do the trick.
    Anybody can help? Also if you know any kind of tutorial for the persistence api if you could point me towards there it would be nice.
    And finally sorry if i have misplaced this post, I couldn't find a better place.
    Thanks, Joaquin

  • Best way to combine Java Persistence API (JPA)  with Visual Web Pack (VWP)?

    I like the JPA/Hibernate development approach to create the database elements from JAVA classes.
    This way one gets rid of the need to keep JAVA code and the database in sync.
    However I have not yet found a good way on how to use JPA from the netbeans VWP.
    Note that I have found the tutorial on how to use the IDE with hibernate and it works without problems.
    However I think this tutorial does not really implement a good Model/View/Controller approach as it is done in the enterprise pack.
    Here you have a controller session bean that deals with all the persistence logic and that exposes properties through a DataModel to the application.
    There is no need to encapsulate logic in inherited classes of the ObjectListDataProvider.
    Maybe an example makes it more clear:
    If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
    How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
    With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
    But how would you do it with JPA?

    You said:
    "If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
    How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
    With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
    But how would you do it with JPA?"
    I have the exact same question. Have you found the answer on how to "join" entities and display them on visual web table component?

  • Object, Query and Java Persistence API

    Hello Java Programmers.
    Question to Object handling with Query results and evaluation.
    Example:
    one table with 3 Columns
    Tablename = ISO6933
    Column 1 = UID
    Column 2 = language name
    Column 3 = language long name
    data in database:
    C1 = 1
    C2 = "ger"
    C3 = "german"
    read the data from database with EntityManagerFactory and EntityManager
    Query query = em.createNativeQuery("SELECT * FROM ISO6933");Final to - Query (Persistence) to Choice (AWT)
    Search short code for example!
    query.setFirstResult(0); // first element -> possible?
    java.util.List queryList = query.getResultList();
    // warnings -> List is a raw type. References to generic type List<E> should be parameterized
    java.awt.List list = new List();
    list.add(queryList.toString()); // for one element in the result, for more elements for/next loop
    // = [1,ger,german]I do not want to use
    - StringTokenizer
    - String.split
    (Cast from java.util.List to java.awt.List = Type mismatch: cannot convert from List to List)
    for one elements from [1,ger,german]
    final to
    1
    ger
    german
    in the AWT List()

    no answer? = is an answer !
    the normal solution would be for example.
         Query query = em.createNativeQuery("SELECT * FROM ISO693_3"); // create query
              query.setFirstResult(0); // first element          
              Object[] objectList = query.getResultList().toArray();          
              // objectList[X] = UID,LANGUAGE_ID,LANGUAGE_NAME
              int intLength = objectList.length; // Length          
              StringTokenizer token; // parser
              String string = new String(); // temp
              for (int i1=0;i1<intLength;i1++)
                   string = objectList[i1].toString();
                   string = string.substring(1, string.length()-1);
                   token = new StringTokenizer(string, ",");
                   while (token.hasMoreElements())
                        list.add(token.nextToken().trim()); // the next element and clean string
              }I look for however a better solution!
    Best greetings

  • Java Persistence API + mySQL and East Europe characters

    Hi,
    I use Sun Application Server 9.0 and mySQL 4.1.20 on Linux. When I put data (with jsf form) into my database table everything is displayed correctly until I restart application server (or redeploy my web app). After restarting server non-ascii characters look strange. I suppose that there is a problem with character coding (between apps server and database) but I can't find any solution. I use UTF-8 character coding both in database fields and for displaying jsf pages.
    There are't any problems when I use Derby database for starage data.
    Thanks

    Can you give some more information ?
    Are you using netbeans 5.5 or doing this program standalone and interfacing
    directly with appserver ?
    Can you send a pointer to a gif of the incorrect looking characters ?
    Can you elaborate about putting data using jsf form and some details
    or extract from the code that writes or reads the data ?
    Do the names of your table or columns have the european characters
    in them or is it just the data ?
    Thanks for your help.
    >
    Thanks
    Hi,
    I use Sun Application Server 9.0 and mySQL 4.1.20 on
    Linux. When I put data (with jsf form) into my
    database table everything is displayed correctly
    until I restart application server (or redeploy my
    web app). After restarting server non-ascii
    characters look strange. I suppose that there is a
    problem with character coding (between apps server
    and database) but I can't find any solution. I use
    UTF-8 character coding both in database fields and
    for displaying jsf pages.
    There are't any problems when I use Derby database
    for starage data.
    Thanks

  • Persistence API newbie question

    Hello everybody!
    I am new at J2EE development, so can you explain me some details. We're curently do J2EE application at work and using J2EE 1.5 features(EJB 3.0, Persistence etc..). I don't understand exactly what lies under annotations. Let's take Persistence API. All anotations and classes is in javax.persistence package. What is that package, where it come from? Is it located in container or where? In fact I would like to use Persistence API on sites managed by Apache Tomcat Server. Is it possible, what classes do I need? Another question is it is possible to use that API at Swing Applications, and what do I need to do this.
    Please, explain me little of where all that stuff come from.
    Thank you!

    anotations and classes is in javax.persistence
    package. What is that package, where it come from? Is
    it located in container or where? Java Persistence API (JPA) is part of JavaEE 5 platform, and so is available in all JavaEE 5 compliant application servers. In JavaEE SDK 5, these classes are in lib/javaee.jar. JPA is also available as a standalone technology. There are several products that are implementing this technology, like Hibernate, TopLink, or OpenJPA.
    The specification:
    http://jcp.org/en/jsr/detail?id=220
    Persistence Part in JavaEE 5 Tutorial (Part Four: Persistence )
    http://java.sun.com/javaee/5/docs/tutorial/doc/
    In fact I would
    like to use Persistence API on sites managed by
    Apache Tomcat Server. Is it possible, what classes do
    I need? Another question is it is possible to use
    that API at Swing Applications, and what do I need to
    do this. They are all possible ways of using JPA. See JavaEE 5 Tutorial for more details. The newly released NetBeans 5.5 has nice support for developing and deploying JPA applications. NetBeans site has a lot of resources on this topic. For example:
    http://www.netbeans.org/kb/55/persistence_ontomcat.html
    http://www.netbeans.org/kb/articles/hibernate-javaee.html
    -cheng

  • Java persistence: sequence generator not working in expected way.

    Hi,
    I just played around with java persistence api and found that sequence generator annotations for making new primary key value not working correctly in my code. following is part of my code related to this problem.
    in entity class:
    @SequenceGenerator(name="mySeq", sequenceName="MY_SEQ_IN_DB")
    @Id
    @GeneratedValue(strategy=SEQUENCE, generator="mySeq")
    @Column(name = "UPLOAD_ID", nullable = false)
    private Integer uploadId;
    I have a sequence called MY_SEQ_IN_DB in my oracle 9i testing db. When I ran the code to save a new entity instance to database I found that the new upload id is not the one that should be created from the MY_SEQ_IN_DB sequence, while the sequence was not increased either. It's instead something starting from 97 (in my pc), and increased just like a sequence, but every time I reran my code the sequence restarted itself again beginning with 97(of course the insert failed with primary key conflict). the behavior just looks like it's a sequence created and managed totally by the persistence api or toplink itself (I guess).
    So, my question is, is this a designed behavior or have I done something wrong to make it not using the correct sequence in the db?
    I used hibernate before, and assigning new primary key from sequence in this way works fine.
    Thanks
    JC.L

    There are some things in Java which can't be serialized. When contained within a higher-level class such as Buttons. A button can be associated with an Action Listener. Now, you can serialize a button; however you can't serialize an action listener - for what should be to you obvious reasons. This is NOT an error and so there is no need to throw an exception when serializing the button.
    Basically: Applet sends servlet button, but not listener.

  • Persistence API on SJS Application Server

    Hello.
    how can i use toplink essentials classes on SJS Application Server Platfor Edition 9? Or, how can i control over client transactions?
    Is there any examples?
    Thanks.

    You can find more information in the Java EE 5 tutorial or in the Java Persistence API glassfish page :
    http://java.sun.com/javaee/5/docs/tutorial/doc/
    https://glassfish.dev.java.net/javaee5/persistence/
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • JPA help needed(Java Persistence)

    Hi friends ,
    Is there any demo for JPA ,
    I have to perform Java Persistence ,
    I have the underlying tables , and I have to access and manipulate them , just like Java objects

    Yordon when I tried to test my service I got this error
    em is my Entity manager instance
    javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacasear*annotation|demo.sap.comjpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.:
    com.sap.engine.services.ejb3.util.pool.PoolException: javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacas~ear*annotation|demo.sap.com~jpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
    at com.sap.engine.services.ejb3.util.pool.ContainerPool.translate(ContainerPool.java:288)
    at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:378)
    at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:342)
    at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:309)
    at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.getMethodReady(StatelessInstanceLifecycleManager.java:64)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:14)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
    at $Proxy367_10002.getDetails(Unknown Source)
    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:585)
    at com.sap.caf.rt.services.serviceaccess.ServiceWrapper.findByDataObject(ServiceWrapper.java:330)
    at com.sap.caf.rt.services.serviceaccess.CAFServiceAccessBeanImpl.findByDataObject(CAFServiceAccessBeanImpl.java:230)
    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:585)
    at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatefulTransactionAssociation.invoke(Interceptors_StatefulTransactionAssociation.java:43)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatefulSessionInstanceGetter.invoke(Interceptors_StatefulSessionInstanceGetter.java:37)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
    at com.sap.engine.services.ejb3.runtime.impl.StatefulBMProxyInvocationHandler.invoke(StatefulBMProxyInvocationHandler.java:55)
    at $Proxy103_10002.findByDataObject(Unknown Source)
    at com.sap.caf.rt.ui.esf.BONodeServiceAccess.findBy(BONodeServiceAccess.java:296)
    at com.sap.caf.rt.ui.esf.Query.execute(Query.java:222)
    at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.TableViewCC.execute(TableViewCC.java:353)
    at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.wdp.InternalTableViewCC.execute(InternalTableViewCC.java:181)
    at com.sap.caf.ui.servicebrowser.components.visualizer.views.TableViewCV.onActionExcuteQuery(TableViewCV.java:429)
    at com.sap.caf.ui.servicebrowser.components.visualizer.views.wdp.InternalTableViewCV.wdInvokeEventHandler(InternalTableViewCV.java:342)
    at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:131)
    at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:72)
    at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.doHandleActionEvent(ProcessingEventPhase.java:156)
    at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.execute(ProcessingEventPhase.java:91)
    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequestPartly(WindowPhaseModel.java:161)
    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doProcessRequest(WindowPhaseModel.java:109)
    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:96)
    at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:469)
    at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:52)
    at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doExecute(ClientApplication.java:1388)
    at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doProcessing(ClientApplication.java:1208)
    at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToApplicationDoProcessing(AbstractExecutionContextDispatcher.java:145)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForAppProcessing.doService(DispatchHandlerForAppProcessing.java:35)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
    at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToApplicationDoProcessing(ExecutionContextDispatcher.java:114)
    at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:80)
    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:506)
    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:526)
    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doApplicationProcessingStandalone(ApplicationSession.java:457)
    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:248)
    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:698)
    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:230)
    at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:228)
    at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToRequestManager(AbstractExecutionContextDispatcher.java:192)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForRequestManager.doService(DispatchHandlerForRequestManager.java:38)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
    at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
    at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToRequestManager(ExecutionContextDispatcher.java:140)
    at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:92)
    at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:104)
    at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doContent(AbstractDispatcherServlet.java:87)
    at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doPost(AbstractDispatcherServlet.java:61)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:66)
    at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:32)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:431)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:289)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:376)
    at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:85)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:160)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:67)
    at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
    at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:309)
    at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.run(Processor.java:222)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
    Caused by: javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacas~ear*annotation|demo.sap.com~jpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:25)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_EJBContext30DependencyInjection.invoke(Interceptors_EJBContext30DependencyInjection.java:11)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ApplicationInstancesCreator.invoke(Interceptors_ApplicationInstancesCreator.java:53)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_NewBeanContext.invoke(Interceptors_NewBeanContext.java:17)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startCallback(DefaultInvocationChainsManager.java:147)
    at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.makeExist(StatelessInstanceLifecycleManager.java:108)
    at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.access$000(StatelessInstanceLifecycleManager.java:23)
    at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager$PoolUserImpl.createObject(StatelessInstanceLifecycleManager.java:34)
    at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:373)
    ... 113 more
    Caused by: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
    at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:115)
    at com.sap.engine.lib.injection.InjectionMatrix.inject(InjectionMatrix.java:45)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:22)
    ... 129 more
    Caused by: com.sap.engine.services.orpersistence.container.exceptions.ResourceException: Persistence unit 'CAR_AL' requested from archive 'demo.sap.com~jpacas~ejbmodule.jar' is not present in application 'demo.sap.com/jpacas~ear' or is not visible to the requested archive.
    at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getPersistenceUnitInfo(ORPersistenceObjectFactory.java:213)
    at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getObjectInstance(ORPersistenceObjectFactory.java:59)
    at com.sap.engine.lib.injection.ReferenceObjectFactory.getObject(ReferenceObjectFactory.java:65)
    at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:113)
    ... 131 more
    Close

  • With Java Persistence, are DAOs (data access objects) still needed?

    I have just looked at the Java Persistence tutorial and it says each table row of a database can be represented as a Java Persistence entity instance.
    The definition of an "entity" is very much like how you would define the class of an equivalent DAO.
    So I am wondering... should DAOs still be used ? or can persistence entities completely replace them?

    Hi,
    I am saying that if you use JPA then you will not be making a DAO class, for example if you have a Person.java object you will not need to make a PersonDAO.java object.
    For example, if using JPA you Person.java object would look like this example below...
    Of course, the classes that call person object may need to call some JPA manager APIs or some JTA transaction APIs. If you use EJB session beans to call the JP{A entity then you dont have to have any code, as ou can see here
    https://blueprints.dev.java.net/bpcatalog/ee5/persistence/ejbfacade.html
    if you do not use EJBs in a pure web app then you will likely manually write code to manage transactions and entity manager APIs such as
    https://blueprints.dev.java.net/bpcatalog/ee5/persistence/webfacade.html
    See Person.java entuty example below and see there is no DAO code.
    @Entity
    public class Person implements java.io.Serializable {
        private int personId;
        private String userName;
        private String firstName;
        private String lastName;
        private String summary;
        public Person() { }
    @Id
    public int getPersonId() {
    return personId;
    public String getUserName() {
    return userName;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    public String getSummary(){
    return summary;
    public void setPersonId(int personId) {
    this.personId = personId;
    public void setUserName(String userName) {
    this.userName = userName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public void setSummary(String summary) {
    this.summary = summary;
    }

Maybe you are looking for