Writing CMP Finder SQL Syntax?

What is the syntax for writing the finder SQL for CMP? From the CMP sample code for the OAS it looks like it might be &fieldname <op> $1 (for the first parameter?)?
Joe McDaniel

You can create custom CMP Finder Methods which takes appropriate sql but not SQLJ and JDBC.
i.e if you are adding a custom finder method in orion-ejb-jar.xml it takes only SQL not java code
In JDeveloper select orion-ejb-jar.xml in the project and right-click on it and choose Settings option
Select the Entity bean in the navigator and choose Finder methods
Click on Add. The dialog box will allow to add a new finder method with SQL query
Click on Help for specific information
Couple of hints are
Partial
Whether or not the specified query is a partial one. A partial query is the 'where' clause or the 'order' (if it starts with order) clause of the SQL query.
Queries are partial by default. If partial="false" is specified then the full query is to be entered as value for the query attribute and you need to make sure that the query produces a result-set containing all of the CMP fields. This is useful when doing advances queries involving table joins and similar.
Query
The query part of an SQL statement. This is the section following the WHERE keyword in the statement. Special tokens are $number which denotes an method argument number and $name which denotes a cmp-field name. For instance the query for "findByAge(int age)" would be (assuming the cmp-field is named 'age'): "$1 = $age".
Return type can be collection if the query is returning more than one row of data or it could be the entity bean type itself (if it is only one row)
raghu
JDev Team

Similar Messages

  • ANSI SQL Syntax - What belongs to join-clause and what to where-clause

    Hello,
    we currently have a discussion about the ANSI SQL Syntax where we do not agree what belongs to the join clause and what belongs to the where clause in an ANSI Sytnax SQL Query.
    Lets say there is a query like this:
    +SELECT *+
    FROM employees emp, departments dept
    WHERE emp.dept_country = dept.dept_country
    AND emp.dept_name = dept.dept_name
    AND dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Primary key of the departments table is on the columns dept_country, dept_name and dept_type. We have a Oracle database 10g.
    Now I have rewritten the query to Ansi Syntax:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name
    WHERE dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Another developer says that this is not completely correct, every filter on a column that belongs to the primary-key of the joined table has to be in the join clause, like this:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    +ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name AND dept.dept_type = 'HQ'
    WHERE emp.emp_lastname = 'Smith'
    Can somebody tell me which on is correct?
    Is there any definition for that? I couldn't find it in the Oracle Database definition.
    I just found out the names of the ANSI documents here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/ap_standard_sql001.htm#i11939
    I had a look at the ANSI webstore but there you have to buy the PDF files. In my case thats exaggerated because both of the Queries work and i am just interessted if there is one correct way.
    Thank you in advance
    Marco

    Hi,
    As i guideline i would say, answer the question: should the result of the join be filtered or should only filtered rows be joined from a particular table?
    This is helpful in the case of outer joins also, for inner joins it doesnt matters as said already be former posters, where there may be hughe semantical differences depending of where the predicates are placed.
    From performance view, if we talk about oracle, take a look a the execution plans. You will see that there is (probably) no difference in case of inner joins. Even in case of outer joins the optimizer pushes the predicate as a filter towards the table if it semantically possible.
    Regards

  • Converting XPATH to SQL syntax?

    HI, all
    I am looking for a third party tool to convert XPATH syntax to SQL syntax?
    XPATH is primary syntax to retrieve and locate data in XML structre, while SQL is the stand syntax to operate data in RDBMS. Please assume I have a way to map XML data to RDBMS.
    Thanks in advance!
    Tao
    2002/11/15

    Did you ever find a solution?????... that�s exactly what I�m trying to do. Any help would be appreciated. Theres like no information on this stuff. Thanks
    bpfl

  • CMP Finder Method

    Could you supply a couple of examples of setting up a custom CMP Finder Method using both SQLJ and JDBC?
    In particular how is the SQL coded in the "SQL Query" textbox on the "Method" tab? How are the parameters and the result set referenced and returned? What is the return type?
    Simple Select / Where clause multirow and single row examples should suffice.
    I using JDeveloper 9.0.2.8.2.
    Thanks.

    You can create custom CMP Finder Methods which takes appropriate sql but not SQLJ and JDBC.
    i.e if you are adding a custom finder method in orion-ejb-jar.xml it takes only SQL not java code
    In JDeveloper select orion-ejb-jar.xml in the project and right-click on it and choose Settings option
    Select the Entity bean in the navigator and choose Finder methods
    Click on Add. The dialog box will allow to add a new finder method with SQL query
    Click on Help for specific information
    Couple of hints are
    Partial
    Whether or not the specified query is a partial one. A partial query is the 'where' clause or the 'order' (if it starts with order) clause of the SQL query.
    Queries are partial by default. If partial="false" is specified then the full query is to be entered as value for the query attribute and you need to make sure that the query produces a result-set containing all of the CMP fields. This is useful when doing advances queries involving table joins and similar.
    Query
    The query part of an SQL statement. This is the section following the WHERE keyword in the statement. Special tokens are $number which denotes an method argument number and $name which denotes a cmp-field name. For instance the query for "findByAge(int age)" would be (assuming the cmp-field is named 'age'): "$1 = $age".
    Return type can be collection if the query is returning more than one row of data or it could be the entity bean type itself (if it is only one row)
    raghu
    JDev Team

  • SQL Developer 1.1.0.21: Issues with Data Grid and SQL syntax checking

    In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion.
    Is there any option to change this behavior?
    Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check.
    I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql.
    Manish

    "In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
    In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
    "Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
    The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
    "I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
    On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
    I use version 1.0.0.15.57 and seems to be working allright.
    - Babu Rangasamy

  • Writing extension for SQL Developer

    Hello all,
    I'm new to writing extensions for SQL Developer using JDeveloper. Can you help me with some example with common functionality, like how to get the current connection? Is there some documentation for the oracle.sqldeveloper package? The example may include some techniques like how to get the schema name for a chosen table, get some other info for the table and so on.
    Thank you in advance!

    Hello all,
    I'm new to writing extensions for SQL Developer using JDeveloper. Can you help me with some example with common functionality, like how to get the current connection? Is there some documentation for the oracle.sqldeveloper package? The example may include some techniques like how to get the schema name for a chosen table, get some other info for the table and so on.
    Thank you in advance!

  • Sql syntax in jsp

    Hey All!
    Im trying ot use a a bean to select data from a table where email != ''
    The funny thing is my code works in one couple of jsp/bean but not in another, even though it's the exact same code.
    This works
    The Bean:
    String sql = "SELECT applicantid, firstname, lastname, dob, " +
    "homestreet, homestate, homecity, homezip, " +
    "email, college, major, standing, " +
    "graddate, schstreet, schcity, schstate, " +
    "schzip, schphone, resOne, resTwo, " +
    "resThree, waiver, bioletter, password, " +
    "homephone " +
    "FROM apptest " +
    "WHERE " + filter + " " +
    "ORDER BY " + orderBy;
    The filter is the String "email != ''" and orderBy ="lastname"
    Works perfectly!
    But when I use similar code for another table
    Code:
    String sql = "SELECT providerid, applicantid, pin, title, " +
    "company, firstname, lastname, phone, " +
    "email, recletter " +
    "FROM provtest " +
    "WHERE " + filter + " " +
    "ORDER BY " + orderBy;
    with filter as "email != '' " and orderBy = "lastname"
    I get the following error:
    Error in findRecords ProviderUtility(Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1")
    Keep in mind that email != '' (these are single quotes)
    I am really baffled.
    Ike

    "The funny thing is my code works in one couple of jsp/bean but not in another, even though it's the exact same code."
    If it's EXACTLY the same code, what did you need another bean for?
    If you needed a new bean, then it's not exactly the same.
    Why aren't you using PreparedStatement to escape strings and dates for you?
    Believe the engine when it tells you there's a mistake.
    %

  • How to find sql statement which generates LOCK

    Hello,
    In my plsql procedure i have used SELECT FOR UPDATE NO WAIT statement to avoid the current record used by another user.
    Actually i want to find which sqlquery is locking the Object other than my procedure.
    I can find the session id which is locking the object but i can not able to find sql text.
    How to find the SQL text from particular LOCKING Session id as v$sql or v$sqltext or v$sqlarea dont have session id?
    Any help can be appreciated.
    Thanks in advance.

    It's not necessarily that easy to find the statement that was responsible for the lock.
    It depends.
    First of all, it depends on version.
    If you're >= 10g and you're lucky and you're licensed for Diagnostic Pack, you might find it in ASH.
    If the statement that's responsible for the lock is also waiting on something else or runs for long enough, then ASH will almost certainly have it.
    Doug Burns has a 10-part series on the subject.
    http://oracledoug.com/serendipity/index.php?/archives/1477-Diagnosing-Locking-Problems-using-ASH-Part-1.html

  • How to find sql statement with Unix process pid

    Hi
    how to find sql statement with Unix process pid
    is there any view to find that.
    please if so let me know
    Thanks in advance

    this is how I am doing this:
    oracle 7352340 7459066 0 07:47:10 - 0:00 oracleJDERED (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle 7459066 5386396 2 07:47:10 pts/1 0:01 sqlplus
    select sid,serial# from v$session where process='7459066';
    SID SERIAL#
    2178 6067
    select sql_text
    from
    v$sqlarea a,
    v$session b
    where a.hash_value = b.sql_hash_value
    and b.sid = 2178
    ;

  • SQL Syntax Issue

    This is a weird one!!!
    I am using Dreamweaver/php/mysql and I am in the process of
    developing the forms that edit articles that have been added to the
    CMS. I have a page called edit.php which has the current list of
    articles. Each article has a radio button next to it and have given
    it an id of "id" (which is what I called it in the DB). On
    selecting this article, and hitting submit, this should load up a
    editnews2.php. On editnews2.php I have a filtered recordset that
    filters on "id " so that it loads the article selected into the
    editnews2 form. I have bound the fields in the form to the related
    fields in the recordset.
    When I test this out using the TEST button, in the recordset
    pop-up window and enter an id, it retrieves the correct article
    from the database. However, when I do it using the forms, I get an
    error:
    "You have an error in your SQL syntax; check the manual that
    corresponds to your Mysql server version for the right syntax to
    use near " at line 1"
    This is really weird because the recordset works and
    retreives the data no problems, which mean the connection file path
    is correct and other parameters are correct. I have tried lots of
    times to try and figure this out but I am now really stuck.
    Could anyone shed some light on this one?
    regards
    orange22

    orange22 wrote:
    > When I test this out using the TEST button, in the
    recordset pop-up window and
    > enter an id, it retrieves the correct article from the
    database. However, when
    > I do it using the forms, I get an error:
    >
    > "You have an error in your SQL syntax; check the manual
    that corresponds to
    > your Mysql server version for the right syntax to use
    near " at line 1"
    What that means is that the way Dreamweaver is building your
    query
    contains a mistake - probably an extra quotation mark or
    something like
    that.
    Go into Code view and use echo to display the actual SQL
    query being
    sent to the database. That will give you a clue as to where
    to start
    troubleshooting the rest of the code.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Error in SQL syntax

    Hi all,
    I have an SQL database which up untli about 20 minutes ago was fine.  I have a complex contact form whic is (was) all finished.  I have added a couple more tables to the database (now totalling 4), in order to create a registration / login page.
    (Is it okay to have 4 tables in 1 database?)
    Anyway.  I have just finished with the login stuff and all works fine.  I decided to have a quick look around the site and make sure everything is okay - but for some reason when I navigate to the "complex contact form" - I get this message:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASCE LIMIT 0, 150' at line 1
    The registration wizard and login pages still work, and in general the site is browseable.  But this page will not work and I have no idea why?
    Does anyone have any suggestion?  All I have done since it worked is add 2 other tables as I said....
    Thank you / please help!
    NJ

    There was a typo in my previous post. There should be only one $ in $query_recordsetName. I should also have added that "recordsetName" is the name of your recordset. I would have thought it was obvious, but I see you're limiting the number of results, so the name is slightly different.
    The other thing is that you have not put it where I told you. Apart from that...
    $query_rscontacts1 = "SELECT contacts.Logo, contacts.Industries,
    contacts.coverage, contacts.misc, contacts.id, contacts.email,
    contacts.website FROM contacts WHERE {$NXTFilter_rscontacts1} ORDER BY
    {$NXTSort_rscontacts1}";
    $query_limit_rscontacts1 = sprintf("%s LIMIT %d, %d", $query_rscontacts1, $startRow_rscontacts1, $maxRows_rscontacts1);
    echo $query_limit_rscontacts1 . '<br />';
    $rscontacts1 = mysql_query($query_limit_rscontacts1, $Contacts) or die(mysql_error());

  • How to find sql server backup was taken under compression mode

    Hello,
    How to find SQL server backup was taken under compression mode ? I have disabled the Compress Mode backup setting but I want to make sure the backup is taken without compression.
    Is there a script for that?
    Thanks
    JK

    I have disabled the Compress Mode backup
    That is only a default setting, in backup command you can always overwrite it to a different value.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Error with SQL syntax

    I'm trying to get onto a website i could normally get into but all it says is this
    you have an error in your SQL syntax;check the manual that corresponds to your MySQL server version for the right syntax to use near') and adlx.'action' !=  2' at line 1
    I'm not good with computers and I've never heard of this i need some help, I may just be stupid but i seriously need some help here
    preferably instructions for a hp computer

    This looks to be an error with the web site you are visiting, not a problem with your PC.  I suggest you contact the web site owner.  The error suggests a problem with programming against a MySQL database, which is not a Microsoft technology.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Need to find sql/users that is parsing but NEVER executing

    hello all,
    I have been trying to figure out how to find sql or user who are pharse sql but not executing them. thats becoz my execute to prase % in my AWR report is negative. meaning someone is parsing statements and NEVER executing them. They are just chewing up your CPU, latching the shared pool, killing your performance.
    which is not a good thing and i want to find out what user is doing that or what SID or what sql is diong whats its doing. How can i find that out. Any querys out there to do that or ?? THANKS
    this is 10.2.0.3 on AIX. and here is part of AWR
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:  100.00       Redo NoWait %:  100.00
                Buffer  Hit   %:   80.74    In-memory Sort %:   99.10
                Library Hit   %:   92.95        Soft Parse %:   91.24
             Execute to Parse %:  -31.89         Latch Hit %:   99.99
    Parse CPU to Parse Elapsd %:   87.32     % Non-Parse CPU:   99.92
    Edited by: user630084 on Mar 13, 2009 7:51 AM

    true i can use that, I am getting about 8 rows out of it and there are about 100+ connections as of now. But here is the thing. As the app use only one schema(lets call it scott). Everybody login thru that schema (scott/tiger)...so that 87 rows that i am getting..all of them are parsing_schema_name=scott and parsing_user_id=55 ..........but i need those 8 users SID...so i can pin point...hey u are the one who is just prasing and not executing...if you know what i mean...so i need that SID...i got the parsing_schema_name and parsing_user_id...but need the SID...so how can i get that ???

  • SQL syntax error...

    SQL Syntax:
    select ename||'-'||job from emp
    Initially, I was using the .Net Framework Data Provider for Oracle and had no problem bringing up the Query Builder in VS 2008. However, when I use the ODP .Net from Oracle, I get an error when bringing up the Query Builder:
    Error in SELECT clause: expression near '|'.
    Unable to parse query text.
    It seems like when uing ODP .Net, it does not like the concatenation in the Select statment.
    Any clue why?

    Is this consistently reproducible for you? Is it query builder specific? What version of ODP are you using? I just tried this with 11.1.6.20 ODP and it worked fine..
    Cheers
    Greg
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    class Program
        static void Main(string[] args)
            using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger"))
                con.Open();
                using (OracleCommand cmd = new OracleCommand("select ename||'-'||job from emp", con))
                    Console.WriteLine(cmd.ExecuteScalar().ToString());
    }

Maybe you are looking for

  • 1.1 - vista - photos don't display

    I upgraded to V1.1 on my Dell Inspiron 9400 and the photos no longer display. I read a couple of other posts that suggested remomving/changing/upgrading video drivers. I've done this, plus removal and reinstall of Lightroom, plus brand new catalogs a

  • ProRes 4444 assets not compositing properly on export

    Hey there! Just trying Premiere out on my first project since jumping ship from FCP. All great thus far, but I'm having an issue with some ProRes assets which have an alpha channel.  They're some animated titles which were made in AE, which are suppo

  • Can't understand this error message

    Hi all, I'm getting this error while compiling the JavaEditorKit example available from java.sun.com - "JavaDocument.java:144: cannot reference this before supertype constructor has been called super(new LocalEnvironment(), newDocumentInputStream(0,

  • Multiple Listeners for one class?

    I have 2 listeners that increment a function synchronized public void increment() a long task... print statements.. It seems that when I run one or the other listener it works fine. but when both are running then only one of the functions shows up. T

  • My computer won't allow me to duplicate a CD!  Error code -8058

    I need to copy a CD and my lousy computer won't allow me. Is there some reason why it's not?