Working with Custom SQL Using Descriptor Query Manager Queries

Hi All,
I am Working on Descriptor Query Manager Queries
Configuring Custom SQL Using Java and Workbench
Using Java I wrote a static method as in the code given below.
public static void insertEmployee(ClassDescriptor descriptor){
descriptor.getQueryManager().setInsertSQLString(
"insert into EMPLOYEE (EMP_ID, EMP_NAME, EMP_JOB, SAL, DEPTNO) values (#EMP_ID, #EMP_NAME, #EMP_JOB, #SAL, #DEPTNO)"
I wrote a insert SQL Query in the custom SQL tab of the Toplink workbench .
Using java and Using Toplink Workbench I had a problem how to call this insert query in the sessionEJBBean .
Can any one suggest me in this regard.
Thanks in advance
regards,
Satish

What is the problem you are experiencing?
Normally you can just execute the query by calling
'executeQuery(queryName, domainclass) on the session.
See also
http://www.oracle.com/technology/products/ias/toplink/
doc/10131/main/_html/qrybas003.htm#BCFIBGGJ
Just out of curiosity: why do you need a custom SQL
to insert something? Can't you use persist()?
regards,
LonnekeOr even UnitOfWork ? Why go down the route of using custom inserts to insert objects unless you have some business logic that Toplink's UnitOfWork API cannot provide ?

Similar Messages

  • Null Pointer Exception when working with Custom Sql

    I viewed the video on adding Custom Sql and everything seemed to work fine with regards to adding it to my report. However, I get a null pointer exception when I add a field from the Custom Sql table to the report and try to run the report including if I try to View Sql. There doesn't seem to be a stacktrace that I can show.
    BTW... this was a work around for not being able to use Stored Procedures... I have killed 2 days now working on different ways to work around the Stored Procedure thing
    Thanks,
    Steve

    Hi,
    I'm trying to use a custom sql in my report. I could successfully create a custom SQL and add it to my report in the designer. But I'm getting NullPointer exception when I try to see the results in Preview. Can someone please help me resolve this issue.
    Thanks!

  • Batch Reading with Custom SQL

    Hello,
    Queries
    1. Is it possible to use Batch Reading in conjunction with Custom Stored Procs/ SQL?
    2. Is it possible to map an attribute to a SQL expression (like in Hibernate we have formula columns mapped using the formula* property)?
    Background
    1. We use Toplink 11g (11.1.1.0.1) (not EclipseLink) in our application and are controlling mapping using XML files (not annotations).
    2. We are migrating a legacy application with most of its data retreival logic present in stored procedures to Java.
    3. I am effectively a newbie to Toplink.
    Scenario
    1. We have a deep class heirarchy with ClassA+ at the following having a one-to-many relation with ClassB+ and ClassB+ having a one-to-many relation with ClassC+ and so on and so forth.
    2. For each of these classes the data retreival logic is present in stored procedures (coming from the legacy application) containing not so simple queries.
    3. Also there are a quite a few attributes that actually represent computed values (computed and returned from the stored procedure). Also the logic for computing the values are not simple either.
    4. So to make things easy we configured toplink to use the stored procedures to retreive data for objects of ClassA+, ClassB+ and ClassC+.
    5. But since the class heirarchy was deep, we ended up firing too many stored procedure calls to the database.
    6. We thought we could use the Batch Reading feature to help with this, but I have come across documentation that says that it wont work if you override toplink's queries with stored procedures.
    7. I wrote some sample code to determine this and for the heirarchy shown above it uses the speicifed Custom procedure (I also tried replacing the stored procs with custom SQL, but the behavior is the same) for ClassA+ and ClassB+, but for ClassC+ and below it resorts to its own generated SQL.
    8. This is a problem because the generated SQL contains the names of the computed columns which is not present in the underlying source tables.
    Thanks
    Arvind

    Batch reading is not supported with custom SQL or stored procedures.
    Join fetching is though, so you may wish to investigate that (you need to ensure you return the correct data from the stored procedure).
    James : http://www.eclipselink.org

  • Can Actions Menu of Interactive Reports work with Custom Authentication?

    My testing is leading my to believe that Actions Menu do not work with Custom Authentication (but only work with APEX Authentication) in APEX 3.1.2? If that's true then is there a work around to this?
    Just to clarify, I've posted/asked this question twice before:
    1) Re: Actions Menu in Interactive Reports does not sort, filter, select cols etc
    2) Interactive Report actions don't work for users (i.e. for non-developers)
    But I've come to believe this is the main problem. I just don't know how to resolve/work around this?
    Thanks for any help.

    I haven't setup a sample because my custom authentication is using LDAP authentication. I'm not sure how I can replicate that on the samples server?
    I'm using LDAP authentication with a Page Sentry function. My further testing reveals that the Page Sentry function is setting the APEX variable user to NULL (ie blank) whenever there's any code in the Page Sentry function box. PL/SQL code as simple as
    BEGIN return TRUE; END;
    in the Page Sentry function box sets the "user" is set to <null>. When the Page sentry function box is left empty (no code specified) it sets the "user" properly after authentication against the specified LDAP directory.
    What all this has to do with Interactive Reports...
    It seems like when the user is NULL it messes-up Interactive Reports that are stored in the flows database. Although it shows the default report properly, but no runtime interactive actions (filtering, sorting, column break, etc.) work.
    Can someone please correct or confirm this?
    Thanks.

  • Discoverer Viewer/Plus does not work with Custom EUL owned by APPS user

    I am facing a unique issue with one of my customers. They have a custom EUL named XX_EUL_US and this does not allow connecting through discoverer viewer or discoverer plus.
    I have worked with custom EULS before at other customers and this was never the case. I am being told that this issue is happening as the EUL owner is APPS instead of some other user. Is this the case? Can discoverer viewer not be used with EULs owned by apps user?
    Please not that the Default EUL in ICX profiles is set to this EUL and no other EUL profiles are set.
    Appreciate any thoughts on this.

    Hi,
    I am not sure what you mean when you say you have a "custom EUL named XX_EUL_US". The EUL table should be created in a schema named XX_EUL_US. This will then be the EUL owner. You will then need to connect to Discoverer Administrator as the EUL owner and grant privileges to Apps users and/or responsibilities.
    The user should then be able to connect to Discoverer Plus/View using their apps username, responsibility and password.
    To be able to connect directly from an apps menu you need to have the ICX parameters set correctly. The ICX: Discoverer Default End User Layer Schema Prefix should be set to XX_EUL (without the _US). The ICX: Discoverer End User Layer Language Override should be set to US or not set at all.
    Rod West

  • How to protect custom applications using oracle access manager?

    Can someone brief me on how to protect custom applications using oracle access manager?

    Is the Custom application a Web Application running on certified platform? If its Web Application then its no different you have to configure the access policies with http(s) as resource type.
    If its not a web application you can write Custom access Gate and then implement. You would configure the policies similar to Web application (you can define your ouwn resource type if you like) and in the custom web gate you will use Access server SDK API to validate the access rules.
    Thanks
    Ram

  • The DB tools doesn't work with Microsoft SQL

    I am tring to write series of waveforms to a database. The DB tools doesn't work with Microsoft SQL, but when i replace the SQL with Access, it works fine. I have to use SQL in the application.
    Any advice pls?
    longing for your reply.
    Attachments:
    test.vi ‏47 KB

    Right off hand I would say the problem is that you are connecting through ODBC. Try the native SQL Server driver, your connect string should define the provider as "SQLOLEDB.1".
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • My Viewsonic monitor won't work with the Imac using the Mini Port to DVI adapter.

    My Viewsonic monitor won't work with the Imac using the Mini Port to DVI adapter. I also tried the HDMI to DVI adapter ane the Mac-Mini with same result. The monitor does work on my older Macbook Pro that has the DVI connector. Is it a Software/Driver issue ?

    Should be extremely simple, please carefully read Connect multiple displays to your Mac. If you still have problems then it's probably a cable issue that would be resolved by replacing the adapter cable. You should be using this adapter. If you are using a third party adapter that might be your problem!

  • Anyone worked with customizing the requisition account generator workflow?

    Has anyone worked with customizing the requisition account generator workflow?
    please let me know
    I need help asap.
    thanks

    Hi Malla,
    Solution here:
    http://garethroberts.blogspot.com/2007/08/gl-account-code-combinations-on-fly-key.html
    Regards,
    Gareth

  • Skipfinalsummary works with MDT integrated TS in Config manager

    Hi Team,
    SkipFinalSummary=YES and FinalAction=Reboot does work with MDT integrated TS in Configuration manager?
    or if do we have any alternative variables that provides similar functionality with MDT integrated TS in config manager ?
    Any pointers will be appreciated.
    Regards,

    The answer can be found in the MDT docs. There is a table that contains each variable and if it will work in what scenario.
    Torsten Meringer | http://www.mssccmfaq.de

  • Adobe forms work with custom Z transactions?

    Hi everybody,
    Does anybody know if the Adobe interactive forms works with custom Z transaction?

    Hi Bertrand,
                 Me too need the sample code could u send me to this [email protected]
    Thnx,
    Vishnu

  • Descriptor query manager and custom PL/SQL call for the data update

    hi all,
    in the application, I'm currently working on, the operations for the data INSERT/UPDATE /DELETE are allowed only by means of PL/SQL function. Using the descriptor's query manager I'm trying to modify default behavior of TopLink and execute PL/SQL when there is a request to modify the data.
    DescriptorQueryManager entityQueryManager = session.getClassDescriptor(MyEntity.class).getQueryManager();
    StoredFunctionCall call = new StoredFunctionCall();
    call.setUsesBinding(true);
    call.setProcedureName("merge_record");
    call.setResult("id", Integer.class);
    call.addNamedArgument("cbic_id", "id"); // MyEntity.getId() – works!
    call.addNamedArgument("publication_flag", "publicationFlag"); // MyEntity.getPublicationFlag () – works!
    call.addNamedArgument("routing_id", "routing"); // MyEntity.getRouring() – works!
    call.addNamedArgument("issue_id", "issue"); // MyEntity.getIssue() – works!
    call.addNamedArgument("country_id", "country"); // MyEntity.getCountry() – works!
    entityQueryManager.setInsertCall(call);
    entityQueryManager.setUpdateCall(call);
    entityQueryManager.setDeleteCall(call);
    the problem:
    when I call: MyEntity savedObject = (MyEntity) UnitOfWork.deepMergeClone(entity);
    the binding doesn’t happen and I see following logs:
    [TopLink Finest]: 2008.02.01 02:51:41.534--UnitOfWork(22937783)--Thread(Thread[AWT-EventQueue-0,6,main])--Merge clone xxx.Entity[id=2000]
    [TopLink Warning]: 2008.02.01 02:51:41.550--ClientSession(8454539)--Thread(Thread[AWT-EventQueue-0,6,main])--Missing Query parameter for named argument: id null will be substituted. (There is no English translation for this message.)
    [TopLink Warning]: 2008.02.01 02:51:41.550--ClientSession(8454539)--Thread(Thread[AWT-EventQueue-0,6,main])--Missing Query parameter for named argument: publicationFlag null will be substituted. (There is no English translation for this message.)
    [TopLink Warning]: 2008.02.01 02:51:41.565--ClientSession(8454539)--Thread(Thread[AWT-EventQueue-0,6,main])--Missing Query parameter for named argument: routing null will be substituted. (There is no English translation for this message.)
    [TopLink Warning]: 2008.02.01 02:51:41.565--ClientSession(8454539)--Thread(Thread[AWT-EventQueue-0,6,main])--Missing Query parameter for named argument: issue null will be substituted. (There is no English translation for this message.)
    [TopLink Warning]: 2008.02.01 02:51:41.565--ClientSession(8454539)--Thread(Thread[AWT-EventQueue-0,6,main])--Missing Query parameter for named argument: country null will be substituted. (There is no English translation for this message.)
    [TopLink Fine]: 2008.02.01 02:51:41.565--ClientSession(8454539)--Connection(6233000)--Thread(Thread[AWT-EventQueue-0,6,main])--BEGIN ? := merge_record(cbic_id=>?, publication_flag=>?, routing=>?, issue=>?, country=>?); END;
    bind => [=> id, null, null, null, null, null] – WHY?
    Calling straight forward the same PL/SQL block using:
    DataModifyQuery updateQuery = new DataModifyQuery();
    updateQuery.setCall(call);
    updateQuery.shouldBindAllParameters();
    and passing parameters as Vector works very well.
    Could you please help me to fix the binding problem when I’m using the PL/SQL with Query Manager?
    regards,

    Hello,
    This is fairly common. Since the database is case insensitive (mostly) field names passed in don't really matter much. Unfortunately, java string comparisons are case sensitive, so if you db column for the getId() property is defined as uppercase "ID" it will not match to the lower case "id" defined in the
    call.addNamedArgument("cbic_id", "id");
    This will cause TopLink to get null when it looks for the "id" field in the row it builds from your MyEntity instance.
    Matching the case exactly will resolve the issue.
    Best Regards,
    Chris

  • Incorrectly read attributes with custom SQL query

    Hi folks,
    I'm trying to read in a random sampling of records from a table, so I tried:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(Foo.class);
    q.addPartialAttribute("bar");
    q.setSQLString("select * from Foo sample(10)");
    q.useCursoredStream(100,100, new ValueReadQuery("select count(*) from Foo sample(10)"));
    This all worked fine, the Foos were retrieved, but after the first dozen or so, all the "bar" attributes were null, which they should not be. This only occurs when using a custom SQL string. I tried bringing back all the objects (i.e., without using setSQLString) and examining them and all the "bar"s were present. But when I use setSQLString the attributes don't get read correctly.
    Can anyone tell me what I'm doing wrong? Is there a better way to do it?
    Thanks,
    Bryn

    Okay, here's the actual code:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(ActivityCenter.class);
    boolean useCustom = true;
    if (useCustom) {
    q.setSQLString("SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, " +
    "Stat, SubType, Acct FROM ACtr");
    q.useCursoredStream(100,100, new ValueReadQuery("select count(IID) from actr"));
    } else {
    q.useCursoredStream(100,100);
    session.logMessages();
    activityCenters = (CursoredStream) session.executeQuery(q);
    ActivityCenter ac = (ActivityCenter) activityCenters.read();
    if (ac.getAccount() == null) {
    System.err.println(ac.getID() + ": Oops!");
    } else {
    System.err.println(ac.getID() + ": Has account!");
    System.exit(0);
    So, everything about this program is the same - how the mapping is done, how things get initialized, everything. The only difference is whether I use a custom SQL query or not. Here's what it looks like when I run it both ways:
    First, custom:
    DatabaseSession(2433702)--Connection(393272)--SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, Stat, SubType, Acct FROM ACtr
    1.1: Oops!
    Now, without the custom SQL:
    DatabaseSession(393272)--Connection(7896086)--SELECT SetupDt, TerminationDt, ReinstateDt, IID, upDt, ID, Stat, SubType, Acct FROM ACtr
    DatabaseSession(393272)--Connection(7896086)--SELECT
    //bunch of fields from the Acct attribute...
    FROM Acct WHERE (IID= 'ffbe5c47f3ea762cfd50fbe9e6d6de6')
    1.1: Has account!
    Notice that the first query on Actr is identical in both cases. Also note there are no null Actr.acct fields in the database:
    SQL> select * from actr where actr.acct is null;
    no rows selected
    SQL>
    This is on Oracle 9i, with the thin jdbc driver.
    Also, I was curious that you asked if I was using partial attributes - when I try to add a partial attribute when using the custom SQL string, I get exceptions like this one:
    java.lang.ClassCastException: oracle.toplink.internal.queryframework.CallQueryMechanism
    at oracle.toplink.queryframework.ObjectLevelReadQuery.initializeDefaultBuilder(Unknown Source)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.getExpressionBuilder(Unknown Source)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.addPartialAttribute(Unknown Source)
    at jenkon.magellan.util.MLMulator.getActivityCenters(MLMulator.java:782)
    at jenkon.magellan.util.MLMulator.run(MLMulator.java:897)
    at jenkon.magellan.util.MLMulator.main(MLMulator.java:943)
    Thanks,
    Bryn

  • RPD - Cannot obtain number of columns for the query result :Working with MS SQL 2012 schema

    Hi All,
    I have created my warehouse in MS SQL 2012.
    For management purpose, I have created different schemas in SQL database
    In RPD, Physical layer, when i view data > I get error as
    [nQSError:16002] Cannot obtain number of columns for the query result.
    [nQSError:16001] ODBC error state : S0002 code : 208 message: [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name 'tbl'..
    [nQSError:16001] ODBC error state : S0002 code : 208 message: [Microsoft][ODBC SQL Server Driver][SQL Server] Statements could not be prepared..
    I have already browsed : OBIEE 11g Strange ODBC Driver Error with SQL Server : Total Business Intelligence ... did not help me
    please help!!!

    Hi All,
    After all R&D it is been found that Oracle business administrator( RPD) needs default dbo schema. It doesn't accept custom schema for pulling data.
    If anybody have other views please share.!!
    Thank you

  • Toshiba File Manager - working with custom file extensions

    Hi Developers,
       I am trying to create an App that handle a specific file extension. I impelemented the required functionality in the Application.
      When someone clicks on the file (say .xyz file) in a Third-Party file manager like AstroFileManager or ES Explorer, Android launches my application with the proper Intent ( ACTION_VIEW). How ever, if I browse to that specific directry using Toshiba File Manager, I get a message saying "There is no associated application for this file type."
     I tried several things and no dice. Does anyone know how I can register a handler for a specific extension for TFM?
    Thanks,
    Windozer

      event.target.info.<yourvariablename>

Maybe you are looking for