How to update a column using hibernate

how to update a particular column using hibernate..
iam using oracle database

I think you didn't get the point. This is a generic Java forum... not a Hibernate forum.

Similar Messages

  • How to update the columns using sql queries?

    create table emp(eno number(5),ename varchar2(20),dno number(2),dname varchar2(20),loc_id number(3), location varchar2(10));
    insert into emp(eno,ename,dno,loc_id) values(1,'tom1',10,1);
    insert into emp(eno,ename,dno,loc_id) values(2,'tom2',20,2);
    insert into emp(eno,ename,dno,loc_id) values(3,'tom3',30,3);
    insert into emp(eno,ename,dno,loc_id) values(4,'tom4',40,4);
    insert into emp(eno,ename,dno,loc_id) values(5,'tom5',50,5);
    insert into emp(eno,ename,dno,loc_id) values(6,'tom6',60,6);
    insert into emp(eno,ename,dno,loc_id) values(7,'tom7',70,7);
    insert into emp(eno,ename,dno,loc_id) values(8,'tom8',80,8);
    create table dept(dno number(3),dname varchar2(10));
    insert into dept values(10,'RM');
    insert into dept values(10,'DD');
    insert into dept values(10,'TD');
    create table location(loc_id number(3),location varchar2(20));
    insert into location values(1,'palani');
    insert into location values(1,'salem');
    insert into location values(1,'kalpattu');
    insert into location values(1,'thirukoyilur');
    insert into location values(2,'thaeni');
    insert into location values(2,'villupuram');
    insert into location values(2,'yercaud');
    insert into location values(3,'thiruvanamalai');
    insert into location values(3,'trichy');
    insert into location values(7,'tanjore');
    insert into location values(4,'tirunelveli');
    insert into location values(4,'namakal');
    insert into location values(5,'bangalore');
    insert into location values(6,'chennai');
    insert into location values(6,'calcutta');
    insert into location values(7,'tirupathy');
    insert into location values(7,'bombay');
    insert into location values(7,'kumbokonam');
    My requirement is to update the department name and location of toms present in employee table without using cursors, loops.
    The column department number and loc_id are used for joins.
    I am in a situation to deliver my code on time.

    try this
    update emp tt
    set (dname,location ) = (
    select res,res1 from (select a.eno,a.ename,a.dno,b.dname,a.loc_id,c.location
    from emp a,
    dept b,
    location c
    where a.dno = b.dno
    and a.loc_id = c.loc_id
    ) t
    where tt.eno = t.eno
    model
    return updated rows
    partition by (eno)
    dimension by (row_number() over (order by eno) as rn)
    measures(cast (dname as varchar2(50))  as res,cast (location as varchar2(300)) as res1)
    rules
    upsert
    iterate(1000)
    until(presentv(res[iteration_number + 2],1,0) = 0)
    res[0] = res[0] ||','|| res[iteration_number + 1],
    res1[0] = res1[0] ||','|| res1[iteration_number + 1]))
    ;output
    1     tom1     10     ,RM,RM,RM,RM,DD,TD,DD,DD,TD,TD,TD,DD     1     ,palani,salem,kalpattu,thirukoyilur,palani,thirukoyilur,kalpattu,thirukoyilur,palani,salem,kalpattu,salem
    2     tom2     20          2     
    3     tom3     30          3     
    4     tom4     40          4     
    5     tom5     50          5     
    6     tom6     60          6     
    7     tom7     70          7     
    8     tom8     80          8     

  • Update some columns using case....

    Hi ,
    Is it possible to update some columns using case statement...????
    For example when col1 is null then update to a value 'x' else update it to the value '*' , when col2 is null then update to a value y else update it to compute the running total up to that time....
    This update statement is contained in db packaged procedure and it receives the values...as parameters....
    How can i write down this update statement...?????
    Many thanks,
    Simon

    Hi ,
    Cant' it be used for two or more columns that have to be updated....????
    i mean
    update table set col_a = case when col_a is null then col_a else '*',
                       col_b = case when col_b is null then col_b else col_b+col_b_var
      end
      where .....The above in bold is running total.... This update is defined in a procedure and it receives numbers as parameters, so the need is to add them for every record it receives...., that's why i set above col_b+col_b_var... where col_b_var is the parameter of the procedure....
    SORRY...IT IS POSSIBLE.....
    Thanks , a lot
    Simon
    Message was edited by:
    sgalaxy

  • How to Update a Row using ADF

    Hi every one
    Can any one help me out, How to Update a Row using ADF.
    Thanks in advance

    In addition to Clear to my question
    By Using ADF BC How can I update a record in a database.
    I have VO and EO associated with a table.
    How can I update a record using ADF BC
    Message was edited by:
    user616296

  • How to update flex to use air 1.5.1

    How to update Flex to use air 1.5.1?
    The last Nightly Build (3.4.0.5042) release today has the
    "old" 1.5 version of air sdk.
    Thanks

    Currently, you have to overlay the AIR 1.5.1 SDK on top of
    your Flex SDK. There are instructions in the AIR 1.5.1 release
    notes:
    http://www.adobe.com/support/documentation/en/air/1_5_1/releasenotes_developers.html#sdk
    The AIR 1.5.1 SDK is available here:
    http://www.adobe.com/products/air/tools/sdk/

  • How to retrieve multiple columns using "returning" in the Insert query.

    hi,
    wanted to know how to retrieve multiple columns using "returning" in the Insert Query.
    For retrieving one column we write the query as follows:
    Insert into TABLE values(1,2,3,4) returning COLUMN1 into PARAMETER
    But can we retrive multiple columns in the same query?
    am using oracle 10g and coding in .NET

    Hi,
    You can definetely get multiple values from a single query using the 'returning' clause.
    Eg : insert into emp (empno, ename, job, deptno) values (7324,'ADAM','MARKETING',30) returning ename, deptno into var1, var2; PN : var1 & var2 to be declared as varchar2 & number respectively.
    More insight into the 'RETURNING' clause in this link.
    http://www.samoratech.com/PLSQL/swArtPLSQLReturn.htm
    Regards,
    Bhanu.

  • How to set unequal columns using master pages in InDesign CS3?

    How to set unequal columns using master pages in InDesign CS3?

    I don't have CS3 anymore but I don't think this has substantially changed in the last few versions of InDesign.
    Choose View > Grids & Guides > uncheck Lock Column Guides. Then drag the column guides to the position you want.

  • How to get last column used in report sorting?

    hi,
    how to get last column used in report sorting?
    simon

    How to identifiy which column was sorted having different reports on page?
    just use:
    'YOUR_STATIC_REGION_NAME' instead of p_static_id,
    :APP_ID for p_app_id,
    :APP_PAGE_ID for p_page_id
    :APP_USER_ID for p_app_user.
    and dont forget to grant SELECT on #OWNER# to APEX_030200.WWV_FLOW_PREFERENCES$
    good luck and thank you Juergen.Schuster
    Simon

  • How to update the ztable using screen.

    hi experts,
    i have one ztable with 8 fields
    and i created one screen with 8 fields
    how to update the ztable using this screen menas when i press the some push button in my screen the table should update.
    Devi

    hi
    check the link shown below
    Coding & screen shots of how to update a database table from screen(Module poool)
    http://www.scribd.com/doc/15628693/moduleprog090311165111phpapp011
    in the attachment u will find
    data  : begin of i_ysrtmm occurs 0,
            sno type ysrtmm-sno,
            sname type ysrtmm-sname,
            scity type ysrtmm-scity,
            sedu type ysrtmm-sedu,
            spercent type ysrtmm-spercent,
            select(1),
            end of i_ysrtmm.
    in the SE51 click on layout & in that menu goto - secwindow- enter the internal table i_ysrtmm
    and click on get from program.u will get all the fields of the internal table select all of them except
    SELECT  field  and then drag and drop on table control . double click on the table control u see the attributes screen there in the w/colselect enter i_ysrtmm-select for tab selection of table control.
    Regards

  • How to update the Ztable using modulepool Tablecontrol...

    Hi All,
    could anyone help me how to update the Ztable using modulepool Tablecontrol...
    if it is possible give me a example with code..
    Many thanks in advance...!!
    Rajesh

    Hi,
    For that pls refer to the link:
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbac3735c111d1829f0000e829fbfe/frameset.htm
    Also refer the sample program:
    RSDEMO02
    Then for updating:
    modify the internal table(which u used to populate the tabcntrl) from the table control.
    Then update database table like:
    update dbtab from table itab.
    Regards,
    Renjith Michael.

  • How to update a column value by comparing old value by using DML Handler...

    Hi Can anyone post the DML Handler code for updating a column value by comparing the old value.
    Thanks,
    Ray

    Hi,
    Here is an example of a DML handler.
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'scott.emp',
    object_type => 'TABLE',
    operation_name => 'UPDATE',
    error_handler => false,
    user_procedure => 'strmadmin.update_column',
    apply_database_link => NULL,
    apply_name => 'MY_APPLY');
    END;
    This DML handler which will send any LCR matching the specified conditions to the strmadmin.update_column for customised processing.
    You can write the strmadmin.update_column procedure so that it extracts the old values from the LCR. You can then use the old values from the LCR to identify the row in the table. Once you identify the row, you can update it as you want.
    I haven't really tried to do any customised processing using DML handlers, but this should work.
    Hope this is of help.
    Sujoy

  • How to update multiple columns from different tables using cursor.

    Hi,
    i have two tables test1 and test2. i want to udpate the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.
    I have a code written as follows :
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
         LOOP
              FETCH C1 INTO v_mydept1,v_mydept2;
              EXIT WHEN C1%NOTFOUND;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
         END LOOP;
         COMMIT;
    END;
    The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].
    It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
    I am not sure what is the exact problem when we want to update multiple columns of different tables.
    Can anyone help me on this ?

    oops my mistake.....typo mistake...it should have been as follows --
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    Now here is the upated PL/SQL code where we are trying to update columns of different tables --
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
    LOOP
    FETCH C1 INTO v_mydept1,v_mydept2;
    EXIT WHEN C1%NOTFOUND;
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    END LOOP;
    COMMIT;
    END;
    Please let us know why it is not updating by using using CURRENT OF

  • How to update a column with default in a tabular form.

    We have a tabular form that has a submit button that does a multi row update. We would like to update a column with a defaut like APP_USER = updated user when the row is updated. Is this possible and how?

    used lovs and conditions.

  • How to update two columns in two tables?

    hi friends
    I have two tables linked to each other through SaleNo and SaleDT. their structure as below
    Sales Table============
    SaleNo int PK auto increment
    SaleDT Datetime PK
    Qnty decimal
    Units decimal
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SaleNo int FK
    SaleDT Datetime FK
    Note that SaleDT column is NOT assigned with getDate() expression.
    1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
    2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
    thanks
    I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!

    Why not below? May be you will not be able to change your design now, but just want to share.
    Sales Table============
    SALEID int PK autoincrement
    SaleNo int
    SaleDT Datetime
    Qnty decimal
    Units decimalUNIQUE (Saleno,SaleDT)
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SALEID int FK

  • Update a column using cursor

    Hi everyone,
    still playing around with newbie stuff here. Is it possible to update a column or a row using a cursor? I understand how to fetch a data using a cursor, but not sure if it can help to update a data.
    If it can, what's the syntax?
    Regards,
    Valerie

    hi,
    why you opted to update rows by using cursor.
    why not you opt DML
    or
    just want to know
    SQL> SET LINE 32323
    SQL> /
    Rollback complete.
    SQL> SELECT *FROM EMP;
          7499 KITTU      SALESMAN        7698 20-FEB-81      15800      25050         30
          7566 JONES      MANAGER         7839 02-APR-81       3175     446.25         20
          7654 RAVIKUMAR  SALESMAN        7698 28-SEP-81       1450     1587.5         30 [email protected]
          7698 BLAKE      MANAGER         7839 01-MAY-81       3050      427.5         30
          7782 CLARK      MANAGER         7839 09-JUN-81       2650      367.5         10
          7788 SCOTT      ANALYST         7566 09-DEC-82       3200        450         20
          7839 KING       PRESIDENT            17-NOV-81       5200       8250         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1700        225         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1300        165         20
          7900 JAMES      CLERK           7698 03-DEC-81       1150       85.5         30 [email protected]
          7902 FORD       ANALYST         7566 03-DEC-81       3200        450         20
          7934 MILLER     CLERK           7782 23-JAN-82       1500        195         10
          8000 KINGBABA   PRESIDENT            17-NOV-81       5200       8250         10
          8001 TURNER RAV SALESMAN        8000 08-SEP-81       1700        450         30
    14 rows selected.
    SQL> DECLARE
      2  CURSOR CUR_EMP IS SELECT *FROM EMP;
      3  CUR_EMP1 CUR_EMP%ROWTYPE;
      4  BEGIN
      5  OPEN  CUR_EMP;
      6  LOOP
      7  FETCH CUR_EMP INTO CUR_EMP1;
      8  EXIT WHEN CUR_EMP%NOTFOUND;
      9  UPDATE EMP SET ENAME='TEST'
    10  WHERE ENAME=CUR_EMP1.ENAME;
    11  END LOOP;
    12  CLOSE CUR_EMP;
    13  END;
    14  /
    PL/SQL procedure successfully completed.
    SQL> SELECT *FROM EMP;
          7499 TEST       SALESMAN        7698 20-FEB-81      15800      25050         30
          7566 TEST       MANAGER         7839 02-APR-81       3175     446.25         20
          7654 TEST       SALESMAN        7698 28-SEP-81       1450     1587.5         30 [email protected]
          7698 TEST       MANAGER         7839 01-MAY-81       3050      427.5         30
          7782 TEST       MANAGER         7839 09-JUN-81       2650      367.5         10
          7788 TEST       ANALYST         7566 09-DEC-82       3200        450         20
          7839 TEST       PRESIDENT            17-NOV-81       5200       8250         10
          7844 TEST       SALESMAN        7698 08-SEP-81       1700        225         30
          7876 TEST       CLERK           7788 12-JAN-83       1300        165         20
          7900 TEST       CLERK           7698 03-DEC-81       1150       85.5         30 [email protected]
          7902 TEST       ANALYST         7566 03-DEC-81       3200        450         20
          7934 TEST       CLERK           7782 23-JAN-82       1500        195         10
          8000 TEST       PRESIDENT            17-NOV-81       5200       8250         10
          8001 TEST       SALESMAN        8000 08-SEP-81       1700        450         30
    14 rows selected.Edited by: user291283 on Sep 1, 2009 10:42 PM

Maybe you are looking for