EJB QL Syntax

Hello
Can anyone help me with the EJB QL syntax for a find method (findByGroup(GroupLocal group)). I've got
"select distinct object(e) from Employee e,
in (e.group) as g where g=?1"
and when I verify I get the error
"Error: [ select distinct object(e) from Employee e,
in (e.group) as g where g=?1 ] has parsing error(s)
Exception occured : [Encountered "in ( e . group" at line 2, column 1.Was expecting one of:    "AbstractSchemaName" ...    "IN" "(" "IdentificationVar" "." "SingleValuedCmrField" ...    "IN" "(" "IdentificationVar" "." "CollectionValuedCmrField" ...   
EJB QL statement : 'select distinct object(e) from Employee e,
in (e.group) as g  where g=?1'
EJB QL method    : public abstract java.util.Collection employee.EmployeeLocalHome.findByGroup(group.GroupLocal) throws javax.ejb.FinderException]"
Thanks in advance

Hello
Can anyone help me with the EJB QL syntax for a find
method (findByGroup(GroupLocal group)). I've got
"select distinct object(e) from Employee e,
in (e.group) as g where g=?1"Hmm. Are you absolutely certain that GROUP indeed is defined as a CMR field for the abstract schema (table) Employee?
Do you have something like:
<cmr-field>
    <cmr-field-name>group</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>In your ejb-jar.xml ?
.P.

Similar Messages

  • Is it possible to use in EJB QL syntax "a.id IN (1,2,3,4)"

    I want to execute query like
    public Collection findbyIds(Integer[] ids);
    SELECT ... FROM Orders o WHERE o.id IN (?1) so, it become
    SELECT ... FROM Orders o WHERE o.id IN (1,2,3,4)
    Is that possible?

    I've used 'IN' operator in EJB Finder ejb-ql and it doesn't work. There isn't compile error when building EJB_project.jar, but 'IN' isn't relevant in ejb-ql. Try to change your SQL statement or use weblogic-ejb-ql.
    Best regards: George Moykin

  • Error while deploying EJB

    Hey Folks
    I am getting following error while deploying my ear file
    Auto-deploying sample-ejb.jar (No previous deployment found)... Error compiling D:\J2EE\SAMPLE\bin\SAMPLE/SAMPLE-ejb.jar: Syntax error in source
    can anybody plz tell me why it is coming
    ASAP help need

    Hi manishnsachdev,
    As per specs :
    The ObjectNotFoundException exception is thrown by a finder method to indicate that the specified EJB object does not exist.
    Since you're not executing any finder methods in your code, you should change your method signature to exclude the ObjectNotFoundException.
    Regards,
    Dimitar

  • Problem while using aggregate functions in EJB QL 2.1

    Hai all,
       I am using aggregate function as follows
       select max(c.id) from customer as c
      for this iam selected check box EJB QL 2.1 in persistent.xml
      this is validated by nwds, but while deploying server raising error like ejb ql syntax error.
      Actually according to EJB QL 2.1 this is a valid query, what i need to do for run this same query .
      Anybody please help me in this regard
    Regards
    Somaraju

    Beevin
      Both two are not even validated,
      but with the first one as select max(c.id) from customer as c , in this case it is validated but while deploying it is error as , object must be return
      But when i saw  the ejb2.1 specification we can write this type of queries also ?
      Is it problem with was any thing
    Regards
    Somaraju

  • EJB QL "LIKE" PROBLEM

    Hai All.
    I got an error when put this EJB-QL syntax :
    <query>
    <query-method>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name LIKE ?1</ejb-ql>
    </query>
    Seems like this method cannot take an arguments, because it runs well when I change the <ejb-ql> syntax with harcode query like this :
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name LIKE %FOO%</ejb-ql>
    Is there something wrong with my first syntax?
    or the EJB-QL cannot take an arguments for LIKE operator in EJB 2.0??
    Below is the error output
    Auto-deploying file:/C:/NS/jdev/TAX_WORKSPACE/TAX_PROJECT/classes/ (No previous deployment found)... Encountered "a . birthdate LIKE ?1" at line 1, column 7.
    EJB QL method : public abstract java.util.Collection gov.tax.business.registration.IEbDummyLocalHome.findByName(java.lang.String) throws javax.ejb.FinderException
    com.sun.ejb.ejbql.EjbQLQuery
    com.sun.ejb.ejbql.parser.EjbQLParser.parse(com.sun.ejb.ejbql.SymbolTable, com.sun.enterprise.deployment.PersistenceDescriptor, java.lang.reflect.Method, java.lang.String)
    Thanx in advance

    Hi,
    You can achieve this by overriding EJB-QL in orion-ejb-jar.xml file. Please look at
    http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/a97677/ql.htm#1005714
    So you can have something like
    <finder-method query="$name like $1"> in orion-ejb-jar.xml
    and a dummy (but valid) ejb-ql in ejb-jar.xml, like
    <ejb-ql>SELECT DISTINCT object (a) FROM DummyData a WHERE a.name =?1</ejb-ql>
    Hope this helps,
    Neelesh
    OTN Team @ IDC

  • Converting Native SQL to EJB ql

    Hi there
    Simple enough question, how would I go about converting the following native SQL query into EJB QL syntax. This by the way is a simple search on keywords attributed to a person.
    SELECT PersonId, COUNT(word)
    FROM keyword_table
    WHERE word = 'a' OR word = 'c' OR word = 'b'
    GROUP BY PersonId HAVING COUNT(word) <= 3
    ORDER BY COUNT(word) desc
    Note that PersonId is a foreign key joinColumn to a Person entity bean, Ideally i want to be returning person objects through a foreign key in my interest table using GROUP BY etc. I had something like this in mind:
    select Person p FROM Interest i WHERE i.Word = 'a' OR i.Word = 'c' OR i.Word = 'b'
    GROUP BY i.Person.PersonId HAVING COUNT(i.Word) <= 3
    ORDER BY COUNT(i.Word) desc
    Kind Regards
    - Vaughan Cross

    suppose there are two beans "Account" and "Transrecord" with 1-to-m relationship, the mapping table is "ACCOUNT"(PK is ACCID) and "TRANSRECORD"(FK is ACCID)
    The cmr field in Account is "transrecords" and the cmr field in Transrecord is "theAccount".
    For a SQL statement (this statment may be not that meaningful, but it is for testing the function of my translation tool):
    SELECT t.* FROM TRANSRECORD t , ACCOUNT A WHERE a.ACCID = t.ACCID
    >>
    one other way of translation would be
    Select object(t) from account a,transrecord t where a.accid = a.transrecords.accid
    select q1.*
    from TRANSRECORD q1, ACCOUNT q2
    where ( q2.\"ACCID\" IS NOT NULL ) and ( q2.\"ACCID\" = q1.\"ACCID\")");
    Since ACCID is the primary key of ACCOUNT table, so "q2.ACCID IS NOT NULL " is always true, the >>SQL statement is equivalent
    with the oringinal SQL statement.isn't it what is supposed to happen since you cannot have a record in the foreign key table without a corresponding record in the primary key table?
    I tested it in Transrecord bean as a defined EJB-QL in WSAD, the generated SQL statement after the >>deployment is:I am using WSAD 5.1, which file has the converted SQLs?
    sanjay.

  • NameNotFoundException in session bean  while running application from jdeve

    hi
    i am getting NameNotFoundException while connection to session bean when i run from Jdeveloper;
    i put ejb.jar.xml and orion-ejb-jar.xml put in classes/META-INF folder;
    in my application index.jsp connects to sessionbean;
    when i run index.jsp i am getting the follo
    [Starting OC4J using the following ports: HTTP=9000, RMI=23891, JMS=9227.]
    C:\j2sdk1.4.2_06\bin\javaw.exe -client -classpath C:\JDeveloper903\j2ee\home\oc4j.jar -Xverify:none -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config C:\JDeveloper903\jdev\system9.0.3.1035\oc4j-config\server.xml
    [waiting for the server to complete its initialization...]
    Embedded OC4J startup time: 4640 ms.
    Target URL -- http://192.168.68.214:9000/1304Release3-etrans-context-root/index.jsp
    Copying default deployment descriptor from archive at C:\JDeveloper903\jdev\mywork\1304Release3.0\EJB\classes/META-INF/orion-ejb-jar.xml to deployment directory C:\JDeveloper903\jdev\system9.0.3.1035\oc4j-config\application-deployments\current-workspace-app\classes...
    Auto-deploying file:/C:/JDeveloper903/jdev/mywork/1304Release3.0/EJB/classes/ (New server version detected)...
    The system is out of resources.
    Consult the following stack trace for details.
    java.lang.OutOfMemoryError
    Error compiling C:\JDeveloper903\jdev\mywork\1304Release3.0\EJB\classes: Syntax error in source
    Log4j Properties file Initialized with Path = C:\JDeveloper903\jdev\mywork\1304Release3.0\etrans\WEB-INF\log4j.properties
    Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized
    No of Hits to this page : 1
    [ERROR   ] ESACLoginController.jsp -- Un Authorised User Not Enough Credentials : ANIL
    [ERROR   ] ESACLoginController.jsp -- Un Authorised User Not Enough Credentials : ANIL
    [ERROR   ] ESACLoginController.jsp -- Un Authorised User Not Enough Credentials : ANIL
    javax.naming.NameNotFoundException: AccessControlSessionBean not found
    at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:130)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:195)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:66)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at ESACLoginController.jspService(ESACLoginController.jsp:89)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    wing in jdeveloper console;

    java.lang.OutOfMemoryError
    Set the jdev.conf directive
    AddVMOption     -Xmx512M

  • Simple EJBQL query

    I am trying to execute the following query.
    SELECT OBJECT(e) FROM Employee e WHERE e.lastName = ?1 AND e.firstName = ?2 AND e.birthDate = ?3
    But It is always returning FiderException, although the record I want to search exists in DataBase. ?
    What could be the problem

    Then it may be problem will your data. char and varchar are stored in different way. Also remove the leading and trailing spaces. I am assuming that ejb ql syntax is correct since your container tool will give you error if not correct.
    --Ashwani                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Paging in ejbql 2.x

    Hi developers,
    I am developing on old entity EJB 2.x and need to achieve paging.
    As we all know, offset and limit operators are unavailable in EJB-ql syntax lower than 3.0
    How can I work around that?
    Should I go down to the dreaded JDBC?
    Thanks in advance
    Regards
    Vincenzo

    I am trying to use native SQL in the persistent.xml

  • OC4J Wrapper problem

    Hi,
    I'm getting the following error during deployment. The code compiles, deploys, and works in J2EE.fine and works:
    Auto-deploying DataFileEntity-ejb.jar (No previous deployment found)... DataFile
    Home_EntityHomeWrapper2.java:694: 'finally' without 'try'.
    finally
    ^
    DataFileHome_EntityHomeWrapper2.java:699: 'try' without 'catch' or 'finally'.
    ^
    DataFileHome_EntityHomeWrapper2.java:703: 'catch' without 'try'.
    catch(java.sql.SQLException e)
    ^
    DataFileHome_EntityHomeWrapper2.java:747: '}' expected.
    ^
    DataFileHome_EntityHomeWrapper2.java:749: 'try' without 'catch' or 'finally'.
    public DataFileHome_EntityHomeWrapper2() throws java.rmi.RemoteException
    ^
    DataFileHome_EntityHomeWrapper2.java:749: Statement expected.
    public DataFileHome_EntityHomeWrapper2() throws java.rmi.RemoteException
    ^
    6 errors
    Error compiling
    :\OC4J\j2ee\home\applications\FMSTest/DataFileEntity-ejb.jar: Syntax error in source
    Any Idea what's going on?
    Is this a OC4J bug?
    Thanks
    Nabil
    null

    Hi Ray,
    This the code:
    * Title: DataFile
    * Description: Remote interface, CMT entity ejb
    * Copyright: Copyright (c) 2001
    * Company:
    * @author Nabil Khalil
    * @version 1.0
    * @since JDK1.3, J2SDKEE1.2.1
    package com.equifax.fms.ejbs.datafile;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface DataFile extends EJBObject {
    public int getModelNum() throws RemoteException;
    public String getFileName() throws RemoteException;
    public String getFileType() throws RemoteException;
    public int getFileLrecl() throws RemoteException;
    public String getFilePath() throws RemoteException;
    public float getFileWeight() throws RemoteException;
    public void setModelNum(int modelNum) throws RemoteException;
    public void setFileType(String fileType) throws RemoteException;
    public void setFileName(String fileName) throws RemoteException;
    public void setFileLrecl(int fileLrecl) throws RemoteException;
    public void setFilePath(String filePath) throws RemoteException;
    public void setFileWeight(float fileWeight) throws RemoteException;
    * Title: DataFileHome
    * Description: Home interface, CMT entity ejb
    * Copyright: Copyright (c) 2001
    * Company:
    * @author Nabil Khalil
    * @version 1.0
    * @since JDK1.3, J2SDKEE1.2.1
    package com.equifax.fms.ejbs.datafile;
    import java.util.Collection;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import javax.ejb.EJBHome;
    public interface DataFileHome extends EJBHome {
    public DataFile create(int modelNum, String fileType, String fileName, int fileLrecl, String filePath,
    float fileWeight) throws RemoteException, CreateException;
    public DataFile findByPrimaryKey(DataFilePKey PKey) throws FinderException, RemoteException;
    public Collection findByModel(int model) throws FinderException, RemoteException;
    * Title: DataFileEJB
    * Description: Bean class, CMT entity ejb
    * Copyright: Copyright (c) 2001
    * Company:
    * @author Nabil Khalil
    * @version 1.0
    * @since JDK1.3, J2SDKEE1.2.1
    package com.equifax.fms.ejbs.datafile;
    import javax.ejb.EntityBean;
    import javax.ejb.CreateException;
    import javax.ejb.EntityContext;
    public class DataFileEJB implements EntityBean {
    public int model_num;
    public String file_type;
    public String file_name;
    public int file_lrecl;
    public String file_path;
    public float file_weight;
    private boolean showInfo = true;
    private EntityContext context;
    public DataFilePKey ejbCreate(int modelNum,
    String fileType,
    String fileName,
    int fileLrecl,
    String filePath,
    float fileWeight ) throws CreateException {
    if (modelNum <= 0 &#0124; &#0124; fileType == null) {
    throw new CreateException("DatFileEJB: model_num and file_type are required to create data_file row.");
    model_num = modelNum;
    file_type = fileType;
    file_name = fileName;
    file_lrecl = fileLrecl;
    file_path = filePath;
    file_weight = fileWeight;
    if (showInfo)
    System.out.println("\n>>>>>>>>>>>> DataFileEJB <<<<<<<<<<\n" +
    " model_num: " + model_num + "\n" +
    " file_type: " + file_type + "\n" +
    " file_name: " + file_name + "\n" +
    " file_lrecl: " + file_lrecl + "\n" +
    " file_path: " + file_path + "\n" +
    "file_weight: " + file_weight + "\n" +
    "======================================="
    return null;
    public int getModelNum() {
    return model_num;
    public String getFileType() {
    return file_type;
    public String getFileName() {
    return file_name;
    public int getFileLrecl() {
    return file_lrecl;
    public String getFilePath() {
    return file_path;
    public float getFileWeight() {
    return file_weight;
    public void setModelNum(int modelNum) {
    model_num = modelNum;
    public void setFileType(String fileType ) {
    file_type = fileType;
    public void setFileName(String fileName) {
    file_nam e = fileName;
    public void setFileLrecl(int fileLrecl) {
    file_lrecl = fileLrecl;
    public void setFilePath(String filePath) {
    file_path = filePath;
    public void setFileWeight(float fileWeight) {
    file_weight = fileWeight;
    public void setEntityContext(EntityContext context) {
    this.context = context;
    public void ejbActivate() {
    DataFilePKey pkey = (DataFilePKey)context.getPrimaryKey();
    public void ejbPassivate() {
    model_num = 0;
    file_type = null;
    DataFilePKey pkey = null;
    public void ejbRemove() { }
    public void ejbLoad() { }
    public void ejbStore() { }
    public void unsetEntityContext() {
    context = null;
    public void ejbPostCreate(int modelNum,
    String fileType,
    String fileName,
    int fileLrecl,
    String filePath,
    float fileWeight ) { }
    * Title: DataFilePKey
    * Description: Primary key class, CMT entity ejb
    * Copyright: Copyright (c) 2001
    * Company:
    * @author Nabil Khalil
    * @version 1.0
    * @since JDK1.3, J2SDKEE1.2.1
    package com.equifax.fms.ejbs.datafile;
    import java.io.Serializable;
    public class DataFilePKey implements Serializable {
    public int model_num;
    public String file_type;
    public DataFilePKey() {};
    public DataFilePKey(int modelNum, String fileType) {
    model_num = modelNum;
    file_type = fileType;
    public int getModelNum() {
    return model_num;
    public String getFileType() {
    return file_type;
    public void setModelNum(int modelNum) {
    model_num = modelNum;
    public void setStep(String fileType) {
    file_type = fileType;
    public boolean equals(Object other) {
    if (other instanceof DataFilePKey) {
    return(model_num == (((DataFilePKey)other).model_num) &&
    file_type.equals((((DataFilePKey)other).file_type)));
    return false;
    public int hashCode() {
    StringBuffer sb = new StringBuffer();
    sb.append(model_num);
    sb.append(file_type);
    String st = sb.toString();
    int hashCode = st.hashCode();
    return hashCode;
    Thanks
    Nabil
    null

  • Pls help - Syntax question about EJB QL

    Hello,
    I'm new learner on EJB. I went through the specification 2.0 of EJB QL released by Sun, I'm not quite understand the syntax definition of SELECT clause in finder method which described in the following words:
    "In the case of a find method, the SELECT clause is restricted to contain either a single range variable or a single value path expression that evaluates to the abstract schema type of the entity bean for which the finder method is defined.
    Because finder method cannot return arbitrary types, the SELECT clause of an EJB QL defined for a finder method must always correspond to the abstract shcema type fo the entity bean for which the finder method is defined.In contrast, the SELECT clause of a query defined for a select method can return the abstract schema types of other entity beans or the values of cmp-fields."
    As my understanding, I think the SELECT clause of finder method can only contain a single range variable instead of single value path expresson, it should have only one format, which is "SELECT [DISTINCT] OBJECT(identification_variable)".
    For example: the query below is defined in OrderBean findByProductType();
    SELECT OBJECT(o) FROM Order o, IN(o.lineItems) l
    WHERE l.product.product_type = 'schoolsupplies'
    how it could be a single value path expression , I think this format can only be used in Select method.
    The other thing is EJB QL2.0 does not support subquery and "NOT EXIST" clause, does this mean that a SQL query with subquery or "NOT EXIST" clause can't be translated to EJB QL?
    I don't know if I'm correct or not. I'd appreciate if anybody can help me with this.
    Thanks!
    Maggie

    Hi,
    Weblogic
    =======
    In the Weblogic-cmp-rdbms-jar.xml file, we define the Table name as created in the DBMS along with cmp-field mapped to the dbms-columns of the table as described below
    <table-map>
    <table-name>SalesAccounts</table-name>
    <field-map>
    <cmp-field>salesaccountId</cmp-field>
    <dbms-column>sales_acctid</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>salesbalance</cmp-field>
    <dbms-column>sales_bal</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>salesaccountType</cmp-field>
    <dbms-column>sales_type</dbms-column>
    </field-map>
    </table-map>
    Here SalesAccounts is the actual table defined in DBMSD like Oracle say which has columns sales_acctid, sales_bal and sales_type.
    In ejb-jar.xml, you define an abstract schema name ie some sort of alias for your table name (SalesAccounts) along with defining the cmp fields required for writing a EJB-QL.
    <abstract-schema-name>SalesAccountBean</abstract-schema-name>
    <cmp-field><field-name>salesaccountId</field-name>
    </cmp-field>
    <cmp-field><field-name>salesbalance</field-name>
    </cmp-field>
    <cmp-field><field-name>salesaccountType</field-name>
    </cmp-field>
    <primkey-field>salesaccountId</primkey-field>
    Here salesaccountid is defined as a Primary key.
    Now your EJB-QL can be defined in the ejb-jar.xml file as follows
    <query>
    <query-method>
    <method-name>findSalesAccountsCondition</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
         <![CDATA[SELECT OBJECT(a) FROM SalesAccountBean AS a WHERE a.salesbalance > ?1]]>
    </ejb-ql>
    </query>
    This should clear ur doubts. Case u have any, revert back to me.
    Rgds,
    Seetesh

  • Dynamic query syntax for EJB

    If i'm going to let the user search the database table (eg. Employee) based on 4 parameters, ie. employee id, employee name, position and address. In cmp entity bean, the stupid way is to create (2 power of 4) findByMethod ejb-ql statements to fulfill the search. Is there any dynamic way to do the querying of table for cmp bean with only one findByMethod?
    Any suggestions or help would be much appreciated. Thanks.

    Hi Julius,
    CMP unfortunately does not support dynamic OQL methods (unless something has changed since the last time I looked at the specs). There are however tools and software (eg powertier) that can provide this type of functionality (like a generic findBySQL(String sql) method) on some J2EE servers.
    One way to solve it of course is to have 4 different methods, and then in your java code have a case or if statements selecting the correct one based on what the user enters. It is not a pretty solution but it would work.
    regards,
    Dion

  • Sun's ejb-jar.xml DTD syntax error

    Hi,
    I tried to validate my ejb-jar.xml. When I use IE to open
    the Sun's DTD file: http://www.java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd,
    IE shows me the following message:
    ====
    Invalid at the top level of the document. Line 1, Position 1
    The file named http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd
    ^
    ====
    Could anybody tell me what went wrong?
    Thanks!
    Please respond to [email protected]

    its been renamed to:
    http://java.sun.com/dtd/ejb-jar_2_0.dtd
    this one works in IE 6

  • Error while calling a method on Bean (EJB 3.0)

    I am getting an error while calling a method on EJB. I am using EJB3.0 and my bean is getting properly deployed(i am sure b'cos i can see the successfullly deployed message). Can any body help me
    Error is -->
    Error while destroying resource :An I/O error has occured while flushing the output - Exception: java.io.IOException: An established connection was aborted by the software in your host machine
    Stack Trace:
    java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
    at sun.nio.ch.IOUtil.write(IOUtil.java:75)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
    at com.sun.enterprise.server.ss.provider.ASOutputStream.write(ASOutputStream.java:138)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
    at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1Connection.java:1031)
    at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:223)
    at $Proxy34.close(Unknown Source)
    at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:274)
    at com.sun.enterprise.resource.LocalTxConnectorAllocator.destroyResource(LocalTxConnectorAllocator.java:103)
    at com.sun.enterprise.resource.AbstractResourcePool.destroyResource(AbstractResourcePool.java:603)
    at com.sun.enterprise.resource.AbstractResourcePool.resourceErrorOccurred(AbstractResourcePool.java:713)
    at com.sun.enterprise.resource.PoolManagerImpl.putbackResourceToPool(PoolManagerImpl.java:424)
    at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:393)
    at com.sun.enterprise.resource.LocalTxConnectionEventListener.connectionClosed(LocalTxConnectionEventListener.java:69)
    at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:618)
    at com.sun.gjc.spi.ConnectionHolder.close(ConnectionHolder.java:163)
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:379)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:367)
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:402)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:100)
    at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:104)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1816)
    at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:161)
    at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:87)
    at com.sun.ejb.containers.ContainerSynchronization.afterCompletion(ContainerSynchronization.java:174)
    at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:467)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
    at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
    at $Proxy84.addDepartment(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.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    End of Stack Trace
    |#]
    RAR5035:Unexpected exception while destroying resource. To get exception stack, please change log level to FINE.
    EJB5018: An exception was thrown during an ejb invocation on [DepartmentSessionBean]
    javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException
    javax.transaction.SystemException
    at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:452)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
    at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
    at $Proxy84.addDepartment(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Means theres an error in XML/ABAP conversion probably due a syntax error...
    Regards
    Juan

  • Can not use SUM in a simple query because of a syntax error?

    Hi
    Thank you for reading my post.
    I am trying to execute the following query:
    q = em.createQuery("SELECT SUM((NE.pipeLength - 0.6)+((NE.networkDepth-NE.initialDepth)*0.41)+ NE.standLenght)  FROM NExpansion NE  where (( NE.contract.contractor=:contractor) AND (NE.pDiameter=:diameter))");
                  q.setParameter("contractor", contractor);
    q.setParameter("diameter", diameter);
         l =  (Long) q.getSingleResult();And I get the following error:
    Caused by: Exception [TOPLINK-8025] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Syntax error parsing the query [SELECT SUM((NE.pipeLength - 0.6)+((NE.networkDepth-NE.initialDepth)*0.41)+ NE.standLenght)  FROM NExpansion NE  where (( NE.contract.contractor=:contractor) AND (NE.pDiameter=:diameter))], line 1, column 12: unexpected token [(].
    Internal Exception: line 1:12: unexpected token: (
            at oracle.toplink.essentials.exceptions.EJBQLException.unexpectedToken(EJBQLException.java:389)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.handleANTLRException(EJBQLParser.java:350)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.addError(EJBQLParser.java:278)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.reportError(EJBQLParser.java:378)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.aggregateExpression(EJBQLParser.java:1416)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectExpression(EJBQLParser.java:1158)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectClause(EJBQLParser.java:403)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectStatement(EJBQLParser.java:178)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.document(EJBQLParser.java:135)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.parse(EJBQLParser.java:166)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.buildParseTree(EJBQLParser.java:127)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:189)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:153)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:114)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
            at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:204)
            ... 30 more
    Caused by: line 1:12: unexpected token: (
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.aggregateExpression(EJBQLParser.java:1365)
            ... 43 morePlease let me know what am I doing wrong?
    Thanks.

    Hello,
    From the grammar in the JPA spec, SUM only takes a state_field_path_expression which is defined as
    state_field_path_expression := {identification_variable | single_valued_association_path_expression}.state_field
    Please feel free to file an enhancement to have this expanded upon.
    Best Regards,
    Chris

Maybe you are looking for

  • How can I reinstall iphoto on new hard drive?

    Original purchase came with iphoto installed.  After hard drive crash new hard drive does not have iphoto app.  Anyone have any idea how to reinstall without having to purchase?  Had to install original OS X 10.6.8 Snow Leopard

  • Report-Recipe Details

    Hai all,            I am working on a Report of displaying all the FG materials for a given Generic Bulk material. Also the desc, plant, base quantity, min and max lot size of both generic and FG. the output should be as shown below: Material        

  • Shared Photo Streams - uploads from multiple users?

    Hi all, Quick question regarding the new Shared Photo Stream feature in iOS 6 and OS X 10.8.2 on iPhoto. You can invite others to be a part of your shared Photo Stream, but if this just so they can view the photos you put in there? I was wondering if

  • Message type in BD10

    Hi Experts, I was created one custom message type ZODNAM_RPWMS. It has basic type MATMAS05 & extenison MATMASNA1. Iam trying to create idoc using BD10. if i press F4 in Message type (R/3 Standard) field in BD10 why iam not able to see my message type

  • 7380 keeps switching itself off

    My 7380 keeps switching itself off - sometimes when its not being touched, sometimes when the controls are touched. It then won't turn back on. Taking the sim card out and putting it back on sometimes works, and the phone will restart, but not all th