[Session beans] Can't make matters!

Hello
I created a simple session bean and find the method works very well. Problem comes with queries... I tried to make this simple query:
Query query = em.createQuery("from Employee e where e.name='myName' ")
but I have this exception:
>
GRAVE: [!] EXCEPTION!] An exception occurred while creating a query in EntityManager:
Description of the exception: syntax error parsing of the request [from employee e where e.name = 'myName'], line 1, column 0: unexpected [in] token.
Inner exception: NoViableAltException(33@[])
>

and this applies to all the queries that I do... I tried different others, but the result is always the same...

HQL, you can drop the 'select' clause, but I don't think you can do this in the JPA query language. have you tried something like "select employee e where e.name = 'myName'?"

More examples here http://docs.oracle.com/javaee/5/tutorial/doc/bnbtg.html.

Published by: jtahlborn on April 13, 2012 13:01

Tags: Java

Similar Questions

  • [ADF, JDev12.1.3] viewScope bean can not recover sessionScope bean. Why? (How to day uploading of a session bean scope whenever a page with params is called)

    Hallo,

    to the login page of my application, I created a viewScope managed bean loginView.

    In the login page, I put a "dummy" inputText (whose value is related to dummyInitEditValue bean attr) to perform lazy loading of the page itself.

    In the initData() function I call a function of a bean sessionScope connection which should initlialize some of its attributes.

    public class LoginView {
      private Integer dummyInitEditValue;
    
      public LoginView() {
      }
    
      private void initData() {
        Login loginBean = (Login) FacesUtils.getManagedBeanInSession("login"); // loginBean = null !!!
        loginBean.initData();
        dummyInitEditValue = 1;
      }
    
      public void setDummyInitEditValue(Integer dummyInitEditValue) {
        this.dummyInitEditValue = dummyInitEditValue;
      }
    
      public Integer getDummyInitEditValue() {
        // Per lazy loading
        if (dummyInitEditValue == null)
          initData();
        return dummyInitEditValue;
      }
    }
    
    
    

    The problem is that the initData() rises a null pointer exception because the bean connection is not found.

    What's not in my approach?

    I create this hoping to resolve this issue: the login page has 2 URL parameters (defined in his point of view in the config.xml file - adfc) and I have according to them I need to update some of the bean sessionScope uploading connection every time the page is called / refreshes (possibly with new values for the parameters).

    BdW I do not know if there is a better alternative you can advice me.

    Thank you

    Federico

    Well, you need to instantiate bean connection somehow.

    You can try to link an attribute of connection bean to the page and see if this will help or you can try to resolve expression programmatically (something like #{connection}).

    Or you can try adding session bean defined as managed property for your bean view extended (something like this: http://umeshagarwal24.blogspot.ba/2012/09/using-managed-property-to-evaluate.html).

    Dario

  • [ADF, JDev12.1.3] Scope of session bean: it can contain attributes related to the Value property of user interface components?

    Hallo,

    I have a defined session bean in which I put a string attribute that is bound to the Value property of an InputText in my testPage.

    public class SessionClass {
    
      private String text;
    
      public void setText(String text) {
        this.text = text;
      }
    
      public String getText() {
        return text;
      }
    }
    

    When I run the testPage, it is not displayed.

    Perhaps this kind of linking is not possible?

    Thank you

    Federico

    Never use prefix in scope to the standard servlet scopes (request, session, application)

    So it would be: #{sessionClass.text}

    Dario

  • Why the method in the several times called session bean

    Hello
    I work with Jdev 11 g.
    I created an example Web J2ee Application.
    In the model project, I created:
    1 - entity Bean
    2 - stateless session bean (which contains a method that get the list of username == > em.createNamedQuery("OsaUser.findAll").getResultList ();)

    In the view controller project I created:
    1 - managed bean, session scope, a getter that calls the session bean and retrieve the result of the query.
    2 - a JSF page with af:table element with the value bound to the list in the managed bean.

    When I run the application, the data is displayed, but since I put system.out message I get this message several times.
    When I try to debug the application the breakpoints on the managed bean and session bean are available several times.

    Can you please advice why this happens.
    Concerning
    Emile BITAR

    Hello

    partially, it's the cycle of life and partially a known bug. The method is called during ApplyRequest and RenderResponse. If you check this in your output, so you see that make answer calls at least three times, which is the bug that we set. As a temporary work around, set a flag within the scope of the request (since your bean's scope of session that you use a requestScope attribute). The first time you run, you set the attribute flag. So every time its called again, you check to see if the indicator exists and if ignore the request. Because the flag is set to request scope, you needn't clean it explicitly

    Frank

  • How can I make firefox save my tabs when I close it?

    Why can't make you it more comfortable and easy to use? Firefox is a great program but its lack of customization. Personally, I think that all that lack of simplicity, unfortunately has no quality. How can I fix this without having to change to another browser?

    Firefox automatically records the tabs when the user closes the it. They are available in history > restore previous Session and at the bottom of the default (topic: Home) home page - restore previous Session

    https://support.Mozilla.org/en-us/KB/how-do-i-restore-my-tabs-last-time
    https://support.Mozilla.org/en-us/KB/restore-previous-session

    ... lack of customization?

    Modules more how much?

    https://addons.Mozilla.org/en-us/Firefox/

  • How can I make several outputs scanned in a single folder? DeskJet 2050 J510

    DeskJet 2050 - J510

    Windows 7

    At present, each image that I scan appears in a separate folder.  It's a nuisance for the mutiple image scans.  How can I make all the images in one session are displayed in the same fiolde, preferably on my desk?

    Hello kayecy

    Lets try to reinstall the software. Please follow the instructions below.

    1. open Control Panel
    2. click on uninstall a program
    3 uninstall the Deskjet 2050 in the list
    4 restart your computer
    5. download and install the latest version of Adobe flash player
     http://get.Adobe.com/flashplayer/
    6 download the drivers and full software functionality, and then reinstall the printer.

    Complete software Deskjet 2050 features

    Let me know if something changes or if the same interface of shows.

  • Error when you try to publish movies with Windows Movie Maker: another user is running Windows Movie Maker on this computer. Please close the other session of Windows Movie Maker before starting Windows Movie Maker again.

    Movie Maker will not film because of "another user is running Movie Maker on this computor... publish »

    I'm trying to publish a movie on this computor in Windows Movie Maker. The files are .wmv with a band his .wav and are all stored on my computor. I performed this task with success several times and there is enough free space on the computor.

    When I click on publish, there are a few seconds where he tries to publish, but then the program goes into a gel and the dialog box appears with the following: "another user is running Windows Movie Maker on this computor. Please close the other session of Windows Movie Maker before starting Windows Movie Maker again".

    When I click Close, there is an icon of wmv on my desk with the title of my project, but it is empty. I am the only user on this computor and I am puzzled as to why this should be implemented. I tried to turn the filters but nothing helped. One thing that I tried was to publish the band sound and the titles and credits without video files and I found it worked.

    Any ideas?

    Thank you Volenteer J. How would you like to know if a .wmv file is corrupt? Is there something I can do to click the .wmv files that tell me if they are corrupt? I need to identify the files that are causing my problem.

    ==================================================
    Sorry... but it seems that I have more questions than answers.

    You said initially that you could publish the soundtrack and titles with success...
    I was wondering if you tried to add a .wmv file to see if you could publish?

    What was the source of the. WMV files? They are all from the same source?

    They were converted from another format? If_Yes_ maybe another
    Converter would be worth a try.

    You change them widely? (split, rotation, transitions...)

    There is a possibility that you could import the Windows Media .wmv files
    Encoder and convert them to... .WMV to .wmv. Seems pointless, I know...
    but it would create a new .version of the. WMV files and can fix that
    perhaps never the problem.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Windows Media Encoder 9 Series
    http://download.CNET.com/Windows-Media-Encoder/3000-2212_4-14887.html

    Using Windows Media Encoder 9 to convert a video file to .wmv
    http://help.UNC.edu/3940

    Re-index WMV files
    http://www.jhepple.com/support/reindexwmv.htm

    Good luck...

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • To access the Session Bean?

    Hello

    With the help of Jdev 11.1.1.7.0. mrequirement is I need to access session Bean on the Module of the Application.


    so I use this way in my implementation of the application module class .

    SessionBeanClassName sessionBeanClassObject is JsfUtils.getManagedBean ("recorded in the adfc-config sessionBeanName").

    I can able to access via the module of the application.

    My question is:

    1. is this good sense?

    2. No Impact on this approach?

    3. is this a good practice?

    4 is one way to access the variable from Session Bean on the application module.

    Thank you.

    Q2) the impact is that you break the mvc pattern and therefore the model of coupling to the display. Later, this can be a problem because your application doesn't fit. Add pass you ui state model (am) you might encounter problems when querying comes into play.

    Sample of Q4) Chris did not access to a bean in scope session leave an application module, but how to get there from an another view layer bean.

    Joel Ramamoorthy-Oracle and Cvele_new_account and myself you asked before, without a real use case all we can say is: don't access scope the model layer session bean.

    Timo

  • Session Bean vs Entity Bean?

    We have a contractor who joined us recently. He is our specialist in the ADF. We don't know much about ADF. He said the layer of data model in the ADF, he must choose between the session beans and entity beans. I am especially ignorant of these things and their implications. I come to know objects entity and visualization of objects from access DB. Can someone give me an idea of what these are? Why not just create entity objects and some objects view and link as I always see in the tutorials? I would ask him, but I'm eager to check what it says of a 3rd party because it seems that it may be misleading us.

    He wants to use Java Beans EJB (Enterprise), while you tell the ADF business components

    Entity Beans

    What is an entity bean?

    https://blogs.Oracle.com/Shay/entry/adf_business_components_or_top

  • Stateful session bean store module in EJB?

    Hello

    I want to use my EJB Stateful Session Bean (SFSB) module. But it seems that I can't use it because I should not inject my SFSB to a managed bean, or message driven bean (because if I do, the SFSB is communicated to all customers)

    I found that the proposed solution is to store SFSB in HttpSession.

    I'm doing this way, but I have null pointer exception.
    HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true); 
    So, how can I do this in the EJB module?

    Thank you

    Well me: hardly. Generally there is a web layer involved with a perfectly good session (or conversation) in what state can be maintained.

    Alas, you don't want to not seem to really say what is on your mind with or without my eyes so I'll offer just a hunch I have. A stateless bean remains "active" that as long as you keep a connection active IE. the reference that you are looking for or inject into your client code. The 'storage in the session bean' you refer to your first post is the Act of perpetuating the bean; as long as the reference is stored in the session you can continue to use it for the same customer without being cleaned by the container. However: when you are working from a web layer there is not a lot of use for a stateful bean because you can simply use the session itself directly to keep the substance. His personal preference if you use them or not really.

    Where you were going wrong in your initial post, is that you get the the HTTP session object in your EJB code. But you probably already figured out for yourself.

  • Cluster server: Replication Session bean

    I use JDeveloper 11.1.1.6.0

    I am currently developing our application for a clustered environment, and I was following section 20.4.3 the following document: http://docs.oracle.com/cd/E23943_01/web.1111/b31974/web_getstarted.htm#CHDIJCIE

    The document mentions that I need to make the beans of sight, pageflow and session as "serializable" and this bean pageflow view range shall be marked as dirty when they are updated. However, session bean did not have to be marked. I have to do something else in order to ensure that changes to the scope of the session is replicated in the cluster? ADF or somehow detect that there is a change and manage this replication for me?

    Thank you.

    The reason why you only need to do this for the beans to view range and pageflow is the way in which they are stored. These scopes are stored as cards in the scope of the session. If you change a bean inside the scope of session card don't know it because she knows that the reference and value.
    Changes to the session scope objects are tracked by the framework.

    Timo

  • Error during the generation of session bean

    Hi all

    EPCO: 12.1.1.1.0

    I created the entities JPA through the Assistant of "JPA entities from Tables" for employees and departments.
    Now, I want to create the bean in session using the Wizard "Session Bean of JPA entities.
    I give it a name and select all of the available features and click on "Finish". Then I got the following error:
    Error running the session bean generation task.
    In the console error log, I see the following:
    org.eclipse.core.commands.ExecutionException: 
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectFromExistingDataModelOperation.execute(EJBProjectFromExistingDataModelOperation.java:67)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.addEJBFacetOperation(NewSessionBeanFromEntitiesWizard.java:249)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.createNewServiceDefnAndGenBeans(NewSessionBeanFromEntitiesWizard.java:219)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.doFinish(NewSessionBeanFromEntitiesWizard.java:169)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.access$0(NewSessionBeanFromEntitiesWizard.java:160)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard$1.run(NewSessionBeanFromEntitiesWizard.java:133)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: org.eclipse.core.runtime.CoreException: 
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:281)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectFromExistingDataModelOperation.execute(EJBProjectFromExistingDataModelOperation.java:61)
         ... 6 more
    Caused by: java.lang.NullPointerException
         at org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider.hasValidRuntime(J2EEModuleFacetInstallDataModelProvider.java:213)
         at org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider.propertySet(J2EEModuleFacetInstallDataModelProvider.java:162)
         at org.eclipse.jst.j2ee.internal.ejb.project.operations.EjbFacetInstallDataModelProvider.propertySet(EjbFacetInstallDataModelProvider.java:137)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.internalSetProperty(DataModelImpl.java:182)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.setProperty(DataModelImpl.java:172)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.setStringProperty(DataModelImpl.java:201)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:126)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:273)
         ... 7 more
    Anyone has any idea what happened and how can I fix?

    Thank you in advance.

    Filip Huysmans.

    To work around this problem, follow these steps:
    -On the model JPA project
    RT - click on, and then select Properties
    -Select project facets
    -Unlock and deselect the facet utility Module
    -Select the facet of the EJB Module and Oracle WebLogic EJB Extensions

    Your project must be ready to perform the given operation.

  • Export of database Session Bean (J2EE 1.4)

    Hello people,

    I try to implement a download of large files for end users, the data are extracted from a database.

    Configuration and Description of the problem:
    ----------------------------------------

    A J2EE 1.4 stateless Session Bean record-wise reads data from a large database table, generates a string of each record and adds the string in a text output for the download stream. The steps involved are (in pseudocode):

    For each record in the database table:
    1.) apply business logic to record data (formatting of numeric values, etc.)
    2.) Accumulate record data in a single string.
    3 writing string.) to an OutputStream

    When finished: download a file over HTTP to the end user.

    The processed data are very large (resulting text file will be 200-1500 MB), I think go with water courses is a feasible solution. An attempt at the interface of Bean Session would be:

    public OutputStream exportDb() {...}

    My problem is: inside the exportDb method, I implémenterai the algorithm described above, but this means that the whole issue will take place in the memory object (in the OutputStream). The download will be executed by a ServletOutputStream. How can I export the database table one recording by the other without implementing the logic of all its activities in a Servlet? The only way I can think is a variant of the Session Bean method that takes the ID of the record that must be treated as a parameter and executes the method in a loop in some servlet code:

    ....
    Somewhere in the Servlet
    OS = getServletOutputStream;

    for (int i = 1; i < nrOfRecords; ++ I) {}
    OS. Write (exportDb (i));
    }

    Is there else any solution "clean"?

    Assuming that you are working with a local ejb, you pass the OutputStream in the method, for example "exportDb (OutputStream out)" and move the outputstream servlet directly to the ejb. If you use a remote ejb, things get more complicated (I wrote a library for broadcasting remotely over rmi, called rmiio, that you can use if you are working with a remote ejb).

  • Alternative for stateful session bean and timer service

    Hello

    I need to write EJB3.0 service that gathers information from network routers (using the SNMP protocol) every 5 seconds. The ideal solution is to have a number of stateful session beans - each representative a connection with different router. (Stateful EJB holds router IP, port, and other properties necessary to communicate via SNMP). It's easy. Worse is how to force stateful bean to send the request every 5 seconds? As I mentioned earlier, the ideal solution would be to use EJB stateful with timer, but which is forbidden by the EJB specification. Is there a j2ee model solve this problem? I also thought using JMS, MessageDrivenBean cannot hold any conversational State, so this does not solve my problem (EJB so that the stateless person does not work).

    Thank you in advance,
    Piotr

    Well first you do the upgrade to JBoss as JBoss 5.1GA 5.0 and 5.01 are far from stable. You should not get any problem to do the upgrade.

    If you have specific needs of other programming that "do this every time X ' then the Scheduler will not really cut. Quartz is more flexible in this regard, so you could investigate that.

    I have myself developed a calendar service on top of JBoss Scheduler however; you could do something similar (I can't share because I do not have the code). JBoss Planner tells the service of every X minutes check calendar's calendar events that need to be pulled. These events are simply stored in the database and the logic is flexible enough to be able to invoke events once, continuously (whenever the calendar service is called), or at specific intervals (every hour, every day, every day of the week).

    Let's take an example. I have an event that triggers every day at 2:00 pm - so the date field would be set today at December 29, 2010 at 14:00. The calendar service is run by the Scheduler of JBoss at 14:01 and decided to raise this event (active events that are less than 48 hours will be triggered to deal with downtime of server). After that he did his thing, the service updates the event date field by combining the current real date and time of the event and adding 24 hours.

    Still the problem of what to invoke when an event is triggered. In my case, I use JMS here; records of the event have a queue name field to which the service sends a generic object message. I can then implement application specific multilateral development banks that take this message and act on it.

  • How to set the session bean of backing bean variable

    Hi all -

    I have a bean with a session variable and I want to set the value of this variable to a bean of support. Could someone please suggest how to achieve this.

    I use ADF 11 g.

    Greetings-
    Rohit

    Hello

    First of all, you need get the referral of bean in the bean to support session, and call the method that sets the value of the attribute. Getting session bean reference - you can use dependency injection, which is the best way, but you must register your bean in faces-config. XML (not adfc - config.xml, see http://biemond.blogspot.com/2010/04/ejb-injection-in-jsf-managed-bean.html).
    An alternative is to search the session bean's JNDI.
    Third option involves data controls: you create a session bean data control and then expose the method to fix your attribute value, in the calling page to jspx pageDef. To do this, you can't use method that begins with 'set', because you will not be able to exhibit in the pageDef (at least not with the Visual Editor). Then, you can call this method from the bean to support using this code:

            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operationBinding = bindings.getOperationBinding("yourSessionBeanMethodExposedInPageDef");
            operationBinding.execute();
    

    I hope this helps.
    Pedja

Maybe you are looking for

  • drive hard keeps disconnecting

    not long ago, I bought a seagate 2 TB backup more hard drive (I think his name?) and not long after that I got it he began to act up, the hard drive itself works absolutely well but every now and then it will automatically disconnects neatly from my

  • Cannot open password protected file.

    Cannot open password protected file. I get a warning that I need to update the numbers, but I am running the most recent version - 3.6.1. Message itself: it's time to update! To open this spreadsheet, you will need the latest version of numbers. Went

  • Satellite L650 - 15G - HARD drive starts after 10 to 15 seconds

    Hi my dear,Please can someone help, I have my Satellite L650 - 15G, I bought 10/01/2010. I have a problem that occurs only with the battery, when I press the power button, I hear the fan starting, lamp wireless, then the lamp light power but not the

  • When I rename an iOS device should I update my iCloud account?

    I have four iOS devices: two iPhones and two iPads. If I rename one of them (in settings, general, all) what I need to also connect to applid.apple.com and play with the list of devices, named it there? The same question could be applied if I get rid

  • Help derivatives (probably my ignorance)

    I take the derivative of a curve of time of position to get the speed. This works except the first and the last point vertically shot excessively. This is probably where my ignorance of not being in a classroom of calculation in a while. I guess it h