Problem with a variable in SQL Statement variable

Hello
I am trying the following query.
hstmt = DBActivateSQL(hdbc, "SELECT UserLevel FROM ClassUsers WHERE Password = "+ cadena +"");
At this point I recieve this error:
Operands of + have illegal types 'pointer to char' and 'pointer to char'.
I have tried this:
hstmt = DBActivateSQL(hdbc, "SELECT UserLevel FROM ClassUsers WHERE Password = "+ &cadena +"");
hstmt = DBActivateSQL(hdbc, "SELECT UserLevel FROM ClassUsers WHERE Password = '"+ cadena +"'");
Still having the same problem.
It works fine if I do this.
hstmt = DBActivateSQL(hdbc, "SELECT UserLevel FROM UserClass WHERE Password = 'cadena'");
Where 'cadena' is treated as a string.
Any Ideas?
Thanks!
There is "No C" in spanish.
If you can think it, you can develop it.
Solved!
Go to Solution.

Nice One JR.
I was using not the VB but the C# .NET method, which I assume is the same as VB way.
Yours is the pretty rigth solution, just missig the adding of "'" (apostrophe character) to diferentiate between chars and numbers at any further query which was solved by the using of strcat() again.
Thanks for this.
Victor
There is "No C" in spanish.
If you can think it, you can develop it.

Similar Messages

  • PL SQL using variable in SQL statement

    I am trying to execute several sql statements, that have the same format but different values. Does this
    mean I need a bind variable?
    ie
    select TO_CHAR ( (SYSDATE - 2), 'YYYY_MM_DD') from dual
    select TO_CHAR ( (SYSDATE - 4), 'YYYY_MM_DD') from dual
    select to_char(add_months(sysdate,-2*1) from dual
    When I try to put the values into a varaiable (date, varchar2 or number) I am getting a conversion
    error.
    Can somebody show me an example of how to do something like this? Or at least point me to the correct
    part of the documentation that provides and example. Pardon my syntax as I know it is incorrect
    val :=add_months(sysdate,-2*1
    select to_char(val) from dual
    Thanks in advance to all who answer

    Hi,
    840386 wrote:
    I am trying to execute several sql statements, that have the same format but different values. Does this
    mean I need a bind variable?No, you don't need a bind variable, though bind variables may be more efficient than using PL/SQL variables. I don't see where you're trying to use any varibables at all in your examples. Is it in place of the literals, such as 2 or 'YYYY_MM_DD'? You can use either bind varibales or PL/SQL variables in those places.
    ie
    select TO_CHAR ( (SYSDATE - 2), 'YYYY_MM_DD') from dual
    select TO_CHAR ( (SYSDATE - 4), 'YYYY_MM_DD') from dual
    select to_char(add_months(sysdate,-2*1) from dualIn PL/SQL, when you have a SELECT statement, you must specify what you want to do with the results. For example, a SELECT ... INTO statement:
    SELECT  AVG (sal)
    INTO    avg_salary
    FROM    scott.emp;There's usually no point in SELECTing from dual in PL/SQL. It's not an error, but it's simpler just to use an assignment statement.
    When I try to put the values into a varaiable (date, varchar2 or number) I am getting a conversion
    error.Post a complete procedure or anonymous block, including variable declarations, that shows exactly what you're trying to do.
    >
    Can somebody show me an example of how to do something like this? Or at least point me to the correct
    part of the documentation that provides and example. Pardon my syntax as I know it is incorrect
    val :=add_months(sysdate,-2*1Assuming val is a DATE, that's basically correct. You have unbalanced parentheses (there's a '(', but no matching ')' ), and you need a semicolon (';') at the end of the statement. Perhaps ');' just got cut off when you were posting this.
    select to_char(val) from dualAgain, SELECTing from dual is unnecessary, but if you had some way to catch the returned value, that would work.
    Usually, the reason why you need to call TO_CHAR is that you want a value in a particular format, which is specified in the 2nd argument to TO_CHAR. Calling TO_CHAR with only one argument is a possible mistake, but not something that would raise an error.
    Here's an example that works:
    SET     SERVEROUTPUT     ON
    DECLARE
         d     DATE;
         v     VARCHAR2 (30);
    BEGIN
         d := ADD_MONTHS (SYSDATE, -2);          -- -2 = (-2*1)
         v := TO_CHAR (d, 'DD-Mon-YYYY');
         dbms_output.put_line (v || ' = v');
    END;
    /Output (when run on March 13, 2011):
    13-Jan-2011 = v

  • Bind Variables in SQL Statement

    can someone tell me if there is a way to find out what the bind variables values are in an sql statement extracted from any of the v$sql or v$sqlarea type tables ?
    sql example:
    update DTree set OriginOwnerID=:A
    where OriginOwnerID=:B and OriginDataID=:C
    Thanks
    Jim

    Hi damorgan
    i see two ot of the three:
    SQL> desc gv$sql_bind_capture
    ERROR:
    ORA-04043: object gv$sql_bind_capture does not exist
    i just trying to see what bind variable values would be associated with the sql when i extract the sql from v$sql and if that is even possible
    Thanks
    Jim

  • Problems with Labivew 2013 / 14 install - Ni Variable Engine error and Labview does not close, processes do not stop when I run Vis.

    Hi All,
    I am hoping at all my problems are relateded to a problem I am experancing, when I look into my windows 7 (64bit) event viewer near every time I boot up I get an error regarding the NI Variable Engine which reads.
    The description for Event ID 0 from source NI Variable Engine cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
    If the event originated on another computer, the display information had to be saved with the event.
    The following information was included with the event:
    C:\Program Files (x86)\National Instruments\Shared\Tagger\ni_tagger_plugin_mxs.dll: Failure to load plugin: Unexpected Error: Unable to get the Interface from the plug-in.
    and a second which is the same apart fomr the last line
    Unable to load the MXS configuration plugIn: Failed to get MAX Configuration interface for Tagger: 0x80040318
    I have tried uninstalling all labview things and I have tried repairing all labivew programs. Along with this I got this error when I installed Labview 2013 so I thougth why not try 2014 and I still get the same problems. I also shoudl point out I use bot 32 bit and 64 bit versions of labivew. I have installed labview on many machines before but never encountered this problem. That being said this was a new clean windows install.
    Along with thiese errors labview heardly ever shuts down properly when I close the program it just freezes and needs forshed shut down.
    Apart form this I noticed that when I run any of my Vis which I have never had problems with in the past and I stop the program somtiems processes keep using CPU such as "lktsrv.exe"
    I really need to get this sorted out because its morstly the crushing and processes not stopping which is rather annoying.
    I shoudl also say that these problems are both in the 32bit and 64 bit versions of labview not difference. and no difference if its 2013 or 2014
    Cheers

    Hi GajanS,
    Thanks for your reply sorry I havetn noticed anybody had replied as I stopped hoping for any responce before then.
    I have attached a screenshot of the four processes that seems to be giving me a problem.
    I have actually managed to find the program causing labivew to crash was in fact my antivirus software which I have now removed and have no more problems with labview crashing on shutdown.
    After removing it I tried the repair feature again for all my labview programs but sadly the one persistant problem remaining is still the four processes using around 13% processor each. I have found out this happens sometime after booting up regardless of if I run labivew or not. So it does not directly seem related to the running of any labview applications but rather a bug in the labview software.
     the processes are:
    lktsrv.exe
    tagsrv.exe
    nidmsrv.exe
    lkads.exe
    as shown in the task manager.
    I would relaly help if I can get this sorted out.
    Cheers
    Attachments:
    Screenshot 2015-03-24 21.50.00.png ‏12 KB

  • Use variable in SQL statement

    HI guys:
    I need code three SQL statements.the returned field and selected table are all same,there is only a difference in their "where" statement.
      Sample code:
        select marcmatnr marcwerks
        into table it_data
        from MARC inner join MBEW on marcmatnr = mbewmatnr
        where marcmatnr like 'A%' and mbewzplp1 = '001'.
        second one........................ mbew~zplp2 = '001'
        third one......................... mbew~zplp3 = '001'
      Could I write a FORM gather them with transporting a parameter ZPLPX to determine which condiniton will be execute?
    thank you very much.

    Hi tianli,
    1. source text
       This concept of dynamic where
       condition is called source text.
    2. use like this.
       This is important in the code  --->  WHERE (mywhere).
    REPORT abc LINE-SIZE 80.
    DATA : it_data LIKE TABLE OF mara WITH HEADER LINE.
    QUOTES ARE IMPORTANT
    PERFORM mysql USING 'mbew~zplp2 = ''001'''.
    FORM mysql USING mywhere.
      SELECT marcmatnr marcwerks
      INTO TABLE it_data
      FROM marc INNER JOIN mbew ON marcmatnr = mbewmatnr
      WHERE (mywhere).
    ENDFORM.                    "mysql
    regards,
    amit m.

  • Help With SUBSTR in dynamic SQL statement

    Following is the dynamic SQL statement.
    EXECUTE IMMEDIATE 'UPDATE table_name pml
    SET pml.'|| con_fields.field ||' = SUBSTR(pml.'||con_fields.field||' ||'' ''||
    (SELECT pml1.'||con_fields.field||'
    FROM table_name pml1
    WHERE pml1.grp_id = '||los_concats.grp_id ||'
    AND pml1.row_id = '||los_concats.row_id||'
    AND pml1.loser_flg = ''Y''),1, '||con_fields.max_length||')
    WHERE pml.grp_id = '||los_concats.grp_id ||'
    AND pml.loser_flg IS NULL ';
    what it does is that it updates a particular field. This field is concatenated by a field of a similar record.
    My problem is with SUBSTR function. Since I am concatenating fields I do not want the field to be updated greater than max_length on that field, the reason why I use SUBSTR. the select query inside SUBSTR works alright with one of the AND condition in a WHERE clause not present. When I add that additional condition it gives me this error.
    ORA-00907: missing right parenthesis.
    Is there any way to get around this problem. Does SQL has other than SUBSTR function which can limit the character length.
    Appreciate it.

    The other alternative I thought about was to do this first
    EXECUTE IMMEDIATE 'SELECT pml.'||con_fields.field||'
    FROM table_name pml
    WHERE pml.grp_id = '||los_concats.grp_id||'
    AND pml.row_id = '||los_concats.row_id||'
    AND pml.loser_flg = ''Y''
    ' INTO v_concat_field;
    write into the variable v_concat_field and then use it into the previous script.
    But on this I get SQL Command not properly terminated, I don't get it Why?
    Donald I tried with your suggested script. It works fine with one of the conditions eliminated. I don't understand what the error trying to say?
    Thanks

  • Pleasse help me with this error in SQL statement

    Please tell me the error in this query:
    the Error given is
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
    given :
    Databse is MS Access
    In the databse :
    account - text
    number - text
    date - date/time
    vendor - text
    Connection connection = t.getConnection();
    /* t - some object containing a connection*/
    Statement stmt = connection.createStatement();
    stmt.executeUpdate("INSERT INTO Bills (account, number, date, vendor)
    VALUES ('vai', '23', 10/12/2006, 'jaadya')");

    I would imagine the problem is with the date. Different DBs have different date formats. To avoid that problem, use a PreparedStatement.
    java.sql.Date date = ...;
    PreparedStatement ps = con.prepareStatement("INSERT INTO Bills (account, number, date, vendor) VALUES (?, ?, ?, ?)");
    ps.setString(1, "vai");
    ps.setString(2, "23);
    ps.setDate(3, date);
    ps.setString(4, "jaadya");
    ps.executeUpdate();This saves you from having to deal with vendors' various date formats, keeps you from having to escape special characters in strings, and prevents SQL injection.

  • Hi Experts... (problem with for do an SQL test)

    Hi people,
    I need to do a SQL test in production Environment. I must optimize a SQL statement like "SELECT field_name FROM table_name.". Normally, I'm doing yhis process:
    1. I make a  Z program, with the SQL statement.
    2. I upload the program to Test environment.
    3. Finally, I upload the program to Production Environment an Test it.
    I understand that this is a long way to do test (I think).
    Can someone help me with another idea?
    Thanks!

    Hi friend,
    This question is linked with SQL test issue.
    I 've this SQL sentence:
      DATA: it_ges LIKE zcctbltar OCCURS 0 WITH HEADER LINE.
      CONSTANTS: l_c_si(2) TYPE c VALUE 'SI'.
      SELECT zmandt zguid_oportunidad zgestor ztipo1 z~tipo2
              ztipo3 zestatus zprioridad zcliente
      APPENDING TABLE it_ges_
      FROM ( zcctbltar AS z INNER JOIN crmd_orderadm_h AS c
             ON zguid_oportunidad = cguid )
      WHERE z~tipo2 = 'ZAP'
      AND c~zztexto27 = l_c_si.
      This sentence needs  6,5 Seconds in INTEGRATION environmet (ZCCTBLTAR have 39.882 items, CRMD_ORDERADM_H have 1.853.334 items).
    The problem is that I need do this process more fast than actually. In PRODUCTION environment, We have 3.179.867 items in CRM_ORDERADM_H (double than INTEGRATION).
    ¿Do U know how optimize this SELECT?
    Thanks,
    Sergio

  • HELP!!! the session hang with a merge into sql statement

    This problem is due to merge into a bug caused it??
    i have a product run on 10.2.0.4 . OS is aix 5.3 .
    today i found the product running over 24,000 sec and the current sql have run 23,734.
    Anomaly the sql Should be a quick end but run so long time.
    the awrsql report sql plan is
    Execution Plan
    Id Operation Name Rows Bytes Cost (%CPU) Time
    0 MERGE STATEMENT 4 (100)
    1 MERGE TP_B_RB013_GL_MID
    2 VIEW
    3 NESTED LOOPS 1 4048 4 (50) 00:00:01
    4 TABLE ACCESS BY INDEX ROWID TP_B_RB013_GL_MID 1 3549 0 (0)
    5 INDEX RANGE SCAN IDX_GL_RB013_MID 1 0 (0)
    6 VIEW PUSHED PREDICATE 1 499 4 (50) 00:00:01
    7 WINDOW SORT PUSHED RANK 1 586 4 (50) 00:00:01
    8 HASH JOIN 1 586 3 (34) 00:00:01
    9 TABLE ACCESS BY INDEX ROWID GL_HIST_RB013 1 124 0 (0)
    10 INDEX SKIP SCAN IDX_GL_RB013 1 0 (0)
    11 TABLE ACCESS FULL GL_EVENT 1 462 2 (0) 00:00:01
    sql_fulltext
    MERGE INTO TP_B_RB013_GL_MID TP
    USING (SELECT TRAN_NO,
    B.EVENT_DEESC,
    ROW_NUMBER () OVER (PARTITION BY TRAN_NO ORDER BY B.EVENT_DESC) I
    FROM GL_HIST_RB013 A, GL_EVENT B
    WHERE EVENT_TYPE IS NOT NULL AND A.EVENT_TYPE = B.EVENT_ID AND B.SDATE = :B1
    ) RES
    ON ( RES.TRAN_NO = TP.BATCH_NO AND RES.I = 1 AND TP.REPORT_DATE = :B1 )
    WHEN MATCHED THEN
    UPDATE SET TP.EVENT_DESC = RES.EVENT_DESC
    Focus is the table "GL_EVENT" have 0 row,the sql should do nothing.
    This problem is due to merge into a bug caused it??
    last is awrsqlrpt Please note cputime and buffer gets
    WORKLOAD REPOSITORY SQL Report
    Snapshot Period Summary
    DB Name DB Id Instance Inst Num Release RAC Host
    FTLPRD 3272430330 FTLPRD 1 10.2.0.4.0 NO bj1finteldb0
    Snap Id Snap Time Sessions Curs/Sess
    Begin Snap: 5022 26-11?-11 21:00:35 127 12.1
    End Snap: 5030 27-11?-11 05:00:40 127 14.0
    Elapsed: 480.09 (mins)
    DB Time: 626.55 (mins)
    SQL Summary DB/Inst: FTLPRD/FTLPRD Snaps: 5022-5030
    Elapsed
    SQL Id Time (ms)
    a4j4qaqkvxr08 ##########
    MERGE INTO TP_B_RB013_GL_MID TP USING (SELECT TRAN_NO, B.EVENT_DESC, ROW_NUMBER
    () OVER (PARTITION BY TRAN_NO ORDER BY B.EVENT_DESC) I FROM GL_HIST_RB013 A, GL_
    EVENT B WHERE EVENT_TYPE IS NOT NULL AND A.EVENT_TYPE = B.EVENT_ID AND B.SDATE =
    :B1 ) RES ON ( RES.TRAN_NO = TP.BATCH_NO AND RES.I = 1 AND TP.REPORT_DATE = :B1
    SQL ID: a4j4qaqkvxr08 DB/Inst: FTLPRD/FTLPRD Snaps: 5022-5030
    -> 1st Capture and Last Capture Snap IDs
    refer to Snapshot IDs witin the snapshot range
    -> MERGE INTO TP_B_RB013_GL_MID TP USING (SELECT TRAN_NO, B.EVENT_DESC, R...
    Plan Hash Total Elapsed 1st Capture Last Capture
    # Value Time(ms) Executions Snap ID Snap ID
    1 3274057091 23,733,870 0 5024 5030
    Plan 1(PHV: 3274057091)
    Plan Statistics DB/Inst: FTLPRD/FTLPRD Snaps: 5022-5030
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
    into the Total Database Time multiplied by 100
    Stat Name Statement Per Execution % Snap
    Elapsed Time (ms) ########## N/A 63.1
    CPU Time (ms) 23,734 N/A 94.7
    Executions 0 N/A N/A
    Buffer Gets 371,326,923 N/A 84.8
    Disk Reads 16,740 N/A 0.2
    Parse Calls 1 N/A 0.0
    Rows 0 N/A N/A
    User I/O Wait Time (ms) 145,938 N/A N/A
    Cluster Wait Time (ms) 0 N/A N/A
    Application Wait Time (ms) 0 N/A N/A
    Concurrency Wait Time (ms) 2,348 N/A N/A
    Invalidations 0 N/A N/A
    Version Count 7 N/A N/A
    Sharable Mem(KB) 435 N/A N/A
    Execution Plan
    Id Operation Name Rows Bytes Cost (%CPU) Time
    0 MERGE STATEMENT 4 (100)
    1 MERGE TP_B_RB013_GL_MID
    2 VIEW
    3 NESTED LOOPS 1 4048 4 (50) 00:00:01
    4 TABLE ACCESS BY INDEX ROWID TP_B_RB013_GL_MID 1 3549 0 (0)
    5 INDEX RANGE SCAN IDX_GL_RB013_MID 1 0 (0)
    6 VIEW PUSHED PREDICATE 1 499 4 (50) 00:00:01
    7 WINDOW SORT PUSHED RANK 1 586 4 (50) 00:00:01
    8 HASH JOIN 1 586 3 (34) 00:00:01
    9 TABLE ACCESS BY INDEX ROWID GL_HIST_RB013 1 124 0 (0)
    10 INDEX SKIP SCAN IDX_GL_RB013 1 0 (0)
    11 TABLE ACCESS FULL GL_EVENT 1 462 2 (0) 00:00:01
    Full SQL Text
    SQL ID SQL Text
    a4j4qaqkvxr0 MERGE INTO TP_B_RB013_GL_MID TP USING (SELECT TRAN_NO, B.EVENT_DE
    ESC, ROW_NUMBER () OVER (PARTITION BY TRAN_NO ORDER BY B.EVENT_DE
    SC) I FROM GL_HIST_RB013 A, GL_EVENT B WHERE EVENT_TYPE IS NOT NU
    LL AND A.EVENT_TYPE = B.EVENT_ID AND B.SDATE = :B1 ) RES ON ( RES
    .TRAN_NO = TP.BATCH_NO AND RES.I = 1 AND TP.REPORT_DATE = :B1 ) W
    HEN MATCHED THEN UPDATE SET TP.EVENT_DESC = RES.EVENT_DESC

    Pl do not spam the forums with duplicate posts - HELP !!!  session pending or suspend beacause a merginto sql

  • Problem with provisioning and external SQL server connection

    I am configuring IPAM 2012 R2 on a our management server.  Completed the first step by enabling the feature.  No issues.
    Now I am on the Provisioning IPAM step.  I get to the Configure Database step...
    I choose Microsoft SQL server,
    What should those values be in the Server name and Database name fields.  Instructions show fqdn or ip address but that doesnt seem to be working for me.
    I get the following error at the end of the Provisioning IPAM wizard,
    IPAM Deployment failed with the following error.
    Failed to connect to database server. Check the database name, connectivity and remote access.
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
    (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)
    You can restart this provisioning wizard from the IPAM overview page.
    From the management server I have tested the SQL Connection with a udl file.  I used myServer\myInstance and it works.  It reports that I have made the Connection to the server and database with the sql credentials i have provided.
    Thanks

    Ran
    into a problem with connecting to the DB on the SQL server from the IPAM server.  The Dba and I checked the target SQL instance was enabled TCP and listening on a valid TCP port.  SQL server was set to use port 1443 for incoming connections. 
    IPAM was set by default to use 1433. 
    Also used
    netstat-n to identify issue and verified 1443 on SQL server was
    being used.  Made the correction under the IPAM provisioning wizard and connected to the database.  Fixed. 
    Important note I was able to connect to the database with a .udlfile
    without any issues
    Also note that 2012 R2 IPAM only supports 2012 SQL Enterprise.  Why?

  • A difficult problem with php code and sql code

    it's good place to visit(Paged Result Sets with PHP and Oracle)
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
    maybe below part php code could not be used in above address's php code.
    if((isset($l_company) and $l_company != $rows['COMPANY']) or empty($stmt) and empty($total_pages) ) {
    echo "<tr bgcolor='#CCFFCC'>";
    echo "<td colspan= 3 align='center'>".$l_company."</td>";
    echo "<td >".$totalcomany." </td>";
    $totalcomany = 0;
    echo "<td > </td>";
    echo "</tr>";
    $l_company = $rows['COMPANY'];
    because the same company in one page could calculate sum while if
    the same company in two pages could not do that.
    and what do you think of ?
    thanks !

    Hi,
    this is because your sql-statement selects only the rows, you need to build this one page.
    Neither php nor the given result from your query knows about data wich will be part of the result of another page.
    Greetings from Hamburg
    Thorsten Körner

  • Problem with JPA Implementations and SQL BIGINT in primary keys

    I have a general Question about the mapping of the SQL datatype BIGINT. I discovered, that there are some different behaviour depending on the JPA implementation. I tested with TopLink Essentials (working) and with Hibernate (not working).
    Here is the case:
    Table definition:
    /*==============================================================*/
    /* Table: CmdQueueIn */
    /*==============================================================*/
    create table MTRACKER.CmdQueueIn
    CmdQueueInId bigint not null global autoincrement,
    Type int,
    Cmd varchar(2048),
    CmdState int,
    MLUser bigint not null,
    ExecutionTime timestamp,
    FinishTime timestamp,
    ExecutionServer varchar(64),
    ScheduleString varchar(64),
    RetryCount int,
    ResultMessage varchar(256),
    RecordState int not null default 1,
    CDate timestamp not null default current timestamp,
    MDate timestamp not null default current timestamp,
    constraint PK_CMDQUEUEIN primary key (CmdQueueInId)
    The java class for this table has the following annotation for the primary key field:
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "CmdQueueInId", nullable = false)
    private BigInteger cmdQueueInId;
    When using hibernate 3.2.1 as JPA provider I get the following exception:
    avax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
    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 org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
    at $Proxy16.persist(Unknown Source)
    at com.trixpert.dao.CmdQueueInDAO.save(CmdQueueInDAO.java:46)
    at com.trixpert.test.dao.CmdQueueInDAOTest.testCreateNewCmd(CmdQueueInDAOTest.java:50)
    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 junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at
    Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
    at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:35)
    at org.hibernate.id.IdentityGenerator$BasicDelegate.getResult(IdentityGenerator.java:157)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2108)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2588)
    at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
    at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
    at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
    ... 34 more
    This means, that their ID generator does not support java.math.BigInteger as datatype.
    But the code works if I take TopLink essentials as JPA Provider.
    Looking at the spec shows the following:
    In chapter 2.1.4 "If generated primary keys are used, only integral types will be portable." Integral datatypes are byte, short, int, long and char. This would mean, that the Hibernate implementation fits the spec but there seem to be a problem in general with BIGINT datatypes.
    I use a SYBASE database. There it is possible to declare a UNSIGNED BIGINT. The range of numbers is therefore 0 - 2^64 - 1. Since in Java a long is always signed it would mean its range is from -2^63 -1 to 2^63 -1. So a mapping of BIGINT to java.lang.long could result in an overflow.
    The interesting thing is, that I used NetBeans to reverse engineer an existing database schema. It generated for all Primary Keys of Type BIGINT automatically a java.math.BigInteger. But for other fields (not being keys) it mapped BIGINTs to java.lang.long.
    It looks like there are some problems with either the spec itself or the implementation of it. While TopLink seems to handle the problem correctly, Hibernate doesn't. But Hibernate seems to fulfill the spec.
    Is anybody familiar with the Spec reading this and can elaborate a little about this situation?
    Many thanks for your input and feedback.
    Tom

    Not sure if I clearly understand your issue, would be good if you can explain it a bit more clearly.
    "I select a value from LOV and this value don't refresh in the view"
    If you mean ViewObject, check if autoSubmit property is set to true.
    Amit

  • Problem with return true and if statement

    I'm making a
    ship shooter
    game and I have a problem with the collision detection for the
    corners of the stage. When you hold down two of the arrows to move
    the ship into the corners of the screen, the ship will go past it.
    The function bellow is what I'm using to detect this collision. The
    reason I'm using a function is because it's used for the ship and
    for all the balls from the cannons (as shown in the last two lines
    of the attached code). This is the reason I need the return true,
    so the if statement can be evaluated to true and then unload the
    movieclip of the cannon ball. When I remove the return true, the
    collision works fine, but obviously my cannon balls all get stuck
    on the edges.
    Any ideas?

    Well the function is called every frame, for the ship and for
    every cannon ball that's on the screen. So it could be called about
    4 times or so per frame. The problem is that ship goes through the
    corners of the stage (btw, the green background is the stage area)
    when you go in a diagonal direction.
    Just curious...what's the unnecessary code you're talking
    about?

  • Problem with or condition in if statement

    Dear Oracle experts,
    I have a strange problem with Oracle 10g1R1 :
    The script below should normally write the value 1, 2, 3, 4, 5, 7, 9, 10 into my table.
    But itwrites all the values from 1 to 10 into my table.
    Only if I use only one condition without the 'or' the
    if condition is successful.
    Is this a normal behaviour of the database ?
    If yes, then why ?
    Best regards,
    Daniel Wetzler
    create table messages (results varchar2(30));
    declare
    var1 number;
    begin
    for i in 1..10 loop
    dbms_output.put_line(i);
    if (i != 6) or (i != 8)
    then
    insert into messages results values (i);
    end if;
    end loop;
    commit;
    end;
    /

    You want to use AND for that condition, not OR
    SQL> begin
      2  for i in 1..10 loop
      3     if (i != 6) and (i != 8)
      4     then
      5        dbms_output.put_line(i);
      6     end if;
      7  end loop;
      8  end;
      9  /
    1
    2
    3
    4
    5
    7
    9
    10

  • Same WITH used in many SQL statements

    Hi,
    I have a need to use the same WITH clause in many places of my code. Is it ever possible to code without writing the same code in every SQL which need my WITH?
    Thanks in advance.

    As Tubs mentioned, views.
    There only 2 basic methods of modularisation of SQL source code. Using the WITH clause (modularises in the same statement), or VIEWS (modularises across SQL statements).
    Using PL/SQL functions or pipelined tables are poor choices for SQL code modularisation. And should not be considered. These tools address a different set of requirements.

Maybe you are looking for

  • Vendor Help is not Displaying in the Front end Screen

    Hi, Iam Working in SRM 5.0, Extended Classic Scenario. I have Replicated all the Vendors & Materials from ECC to SRM. While Iam trying to create SC, if i select the Preferred Vendor Search Help iam getting the vendor Pop Up Screen in that i have all

  • Exchange rate type  not visible

    I want to maintain my own currency convertion method in BW ,we can do this in T-code RSCUR I have maintaned  my Exchange rate type in the table TCURR and then use this as the Exchange rate type in T-code RSCUR but when I press F4 ifor Exchange rate t

  • CS5 - Recolor artwork not working?

    I have a file with a number of artboards on which there are objetcs filled with 100% Magenta and some with 100% Magenta and 0,34% Yellow. I want to get rid of that 0,34% but Illy is refusing to cooperate. Even selecting just two or three objects and

  • PE7 (& 8) error message missing adobepsl.dll when writing to disc

    I have been using PE7 exclusively even though I purchased PE8 since it didn't work on my Windows 7 64 bit laptop.  I edited a video without any problems like usual and when I went to write it to a disc, it wouldn't write and I got an error message th

  • I now have 6 iphones, apple tv, ipad. how do they all work on the match

    I now have 6 iphones, apple tv, ipad. how do they all work on the match