Create new rows or update rows in database table

I have few table in database.
I catch some values in my bean. Now I must put that values in my database tables. Values are in different tables.
How can I update tables in database? Ok I know that my solution is updateable (entity) viewObject but please ... some example or description are welcome!
Thx.
Message was edited by:
sinnerman

Hi Frank. I read developer guide but this is detail and if you can help ... thanx in advance.
I put code ... in my bean ... I need to insert row in table and commit. Please if you can answer me what`s wrong?
code:
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
//Find corresponding object where variable "bindings" reside
DCBindingContainer binding =
(DCBindingContainer)app.getVariableResolver().resolveVariable(fc,
"bindings");
//Find the data control by name from the binding container
DCDataControl dcCtl =
binding.findDataControl("TMFStudServiceDataControl");
//Retreive application module
TMFStudServiceImpl am =
(TMFStudServiceImpl)dcCtl.getApplicationModule();
ViewObject vo = am.getGetIdStudentAnketaPitanje();
ViewObject studentAnketaOdgovor = am.getStudentAnketaOdgovor();
while (j < my_list.size()) {
t = (Object)lista.get(j);
System.out.println("IdOdgovora: " + t.toString());
vo.setNamedWhereClauseParam("p_id_odgovora", t.toString());
vo.executeQuery();
Row currRow = vo.next();
System.out.println("IdStudentAnketaPitanje: +currRow.getAttribute("IdStudentAnketaPitanje"));
//am.insertStudentAnketaOdgovor();
Row newStudentAnketaOdgovor = studentAnketaOdgovor.createRow();
studentAnketaOdgovor.last();
studentAnketaOdgovor.next();
newStudentAnketaOdgovor.setAttribute("IdStudentAnketaPitanje", 1);
newStudentAnketaOdgovor.setAttribute("IdOdgovor", 2);
studentAnketaOdgovor.insertRow(newStudentAnketaOdgovor);
am.getDBTransaction().commit();
}

Similar Messages

  • New JNDI name created for each drag and drop of database table into table

    Hi All,
    I'm using Netbeans 5.5 with Visual Web Pack with Mysql as backend. Whenever I drag and drop a database table into table component it creates new JNDI (data source) name for each table. I want to use single JNDI name for all tables. If I change the JNDI name to default name then the design disappears and shows error . Is there any option to set the JNDI name unique for all tables?
    Thanks in advance.

    Hi again,
    Well I've tried using the MouseListener / MouseMotionListener approach but it doesn't quite seem to work, although it does get the events correctly. I think the reason is that it doesn't interact correctly with the Java DnD machinery which is something that V.V hinted at. It's something that I may need to look into if / when I have more time available.
    I have to say though that I haven't had any problems with scrollbars - we're making fairly heavy use of large tables and if you drag over a table with a scroll bar and move to the top or bottom then it scrolls as you would expect and allows you to drop the data where you like. For this situation I've used pretty much the same approach as for the toy example above except that I've implemented separate source and destination TransferHandlers (the source table is read-only, and it really doesn't make sense to allow people to drag from the destination table so I've essentially split the functionality of the example handler down the middle).
    I'm not actually particularly in favour of messing too much with the mechanics of DnD, more because of lack of time than anything else. Guess I'll just have to put up with this for the moment. Doesn't help that DnD is so poorly documented by Sun.
    Thanks for all your help.
    Bart

  • To create workflow process which periodically examines one database table??

    hi.......
    plz tell me the complete details that how to create workflow process which periodically examines one database table??
    also it will send email to specific address if certain condition is not fulfilled??
    help is really appreciated
    thanks nd regards
    manish singla

    Hi,
    I'd be wary of using a WAIT activity, since this will essentially have the workflow running forever in the same SQL session. If you ever need to shutdown the database, then you would have to kill the session (or do a shutdown abort), which will rollback all the Workflow transactional data.
    I would leave the polling logic to a process outside the Workflow engine. In an Applications environment, this should be a Concurrent request. If this is standalone Workflow, then schedule something using DBMS_JOB. The job should check the database, and if necessary, initiate a new workflow to send the notification.
    If the notification does not require a response, then I would be inclined to bypass Workflow competely, and have a job which calls UTL_SMTP to send an email.
    HTH,
    Matt
    Alpha review chapters from my book "Developing With Oracle Workflow" are available on my website:
    http://www.workflowfaq.com
    http://forum.workflowfaq.com

  • Updating values in database table through Transaction

    Hi,
    Actually We have one transaction named EWAWA01. In that when we display the values from the transaction, there is a netweight field. The transaction displaying netweight values, but that value is not updated in the database table named EWA_WA_WEIGHPROC. How can i update that netweight value in the table.

    data:v_v_EWA_WA_WEIGHPROC type  (v_EWA_WA_WEIGHPROC lenth) c.
    decleare the data in charter type.
    after pass the data charter type.
    v_EWA_WA_WEIGHPROC = EWA_WA_WEIGHPROC
    update db.

  • Efficient way of updating data to database table

    what is the efficient way of updating data to database table  .
    i have huge amount of data in my internal table  , how to use update statement in this case .
    1. database table having 20 fields  ,
    2. one is key field and suppose 20 th field i want to change  .
    3. I have data for only 2 fields , i.e for ( 1 st and last 20 th field ) .
    i can't use update statement in loop , as it is not good practice(hits database several times ) .
    do it effects all the 20 fields for  particular record .

    Hi,
    Use UPDATE statement , check below description from SAP help.
    UPDATE dbtab FROM TABLE itab. or UPDATE (dbtabname) FROM TABLE itab.
    Effect
    Mass update of several lines in a database table.Here, the primary key for identifying the lines tobe updated and the values to be changed are taken from the lines of theinternal table itab. 
    The system field SY-DBCNT contains the number of updated lines,i.e. the number of lines in the internal table itab which havekey values corresponding to lines in the database table.
    Regards
    L Appana

  • How to find for ex : kunnr is updating how many database tables

    Hi all
    How to find for ex : kunnr is updating how many database tables .
    Rgds
    Rafi .

    hi rafi
    go to se15->abap dictionary->fields->table fields-> give kunnr at  field name text box->press f8.
    then it will show ,in how many tables the kunnr field exist.the kunnr field updates those tables.
    don't forget reward points.
    kiran

  • How to control the number of rows selected from a sybase database table?

    Hi, JDBC guru,
    I'm working on project using Sybase 11.9.x database.We need to process a record in a table,first select it from the table,then do some computing,finally write it to a dbf file, if the above steps succeed,remove the original row in the table.Quite evidently, all these operation should be put into one transaction. But how can I select just a number of rows from the sybase database table?
    Any hints?
    Thank you in advance.
    Regards,
    Jusitne

    Statement stmt...
    stmt.setMaxRows(20);

  • Creating BAM report using data of two database tables. Say "EmployeeTable" and "DepartmentTable

    I want to populate data from two database tables into a BAM report. I have created two data objects for the tables and want to create 3rd data object so that it can take the data from the other data objects automatically. Is there any such facility within BAM?

    Hi
    1. I am not sure if you have option to combine multiple DataObjects like that.
    2. For your scenario, on Database side itself, I would recommend Create a VIEW that joins these 2 Tables and pull the required Columns and add required conditions. Verify the VIEW has all the rows expected.
    3. Then create DataObject for this View. Once you have DataObject, create the Report.
    Thanks
    Ravi Jegga

  • Update ztable from database table directly

    hi all,
    can u tell me the possible ways to update a ztable from database table directly.
    i mean is there anyway to update ztable whenever entry is created in database table .
    i dont want to update using insert,modify statements.
    points will be rewarded to all hlpful answers.

    A slightly dirty solution:
    Use SAP functions for reading from CDHEADER and CDPOS tables [with enough filters such that you extract minimum records possible] to read changes to MARA table fields since last run of your program. Use this information to update your ZTABLE. I would recommend having a table maintainance generator on ZTABLE. The actual update should be by a BDC by calling transaction SM30 for ZTABLE maintainance. Now the program may be set up as a batch job running 1ce an hour. You get updates to the extent of 1 hour latency.
    Alternatively, you may look if an opportunistic BADI / user Exit is there alongside MM01/02 transactions - assuming the latter are the only ones updating MARA. In this BADI you may write the code to update ZTABLE- again, look to do it by BDC call transaction sm30 to maintain ZTable. To lighten up the code -load on BADI you may simply raise a custom event and move on. You will configure a job that runs your program when that particular event is raised. This will need the 'burden' of figuring out the changes, though.
    An elegant way would be to fire a MATMAS fIDOC for every change to Material, capture that and turn back the changes to ZTABLE. This will facilitate the delta load.

  • Creating new ODBC connection does not show the tables

    Post Author: reemjacob
    CA Forum: Data Connectivity and SQL
    Hello
    I am creating a new ODBC Connection to SQL Server in Database Expert. Once I created the ODBC when I expand the Database I should be seeing the tables, views and stored procedures. But instead I am only seeing stored procedures. When I right click on the DB and go to options I see that Tables, Views and Stored Procedures are checked. How can I correct this so that I see the Tables and Views?
    Regards
    Reem

    Not an Oracle proble. Not an instant driver problem.
    If the ODBC tool and driver you use, fail to construct the proper SQL to interrogate the very rich Oracle data dictionary.. what is Oracle suppose to do? Fix the software from those vendors for the user? Not going to happen. Get Oracle Raptor instead and use a proper Oracle client.
    Simple test. Run the following SQLs via your ODBC connection.
    To see all your objects in your schema (i.e. the one you logged into via ODBC):
    SELECT * FROM user_objects
    To see a list of schemas:
    SELECT username FROM all_users ORDER BY 1
    To view other schemas' contents:
    SELECT * FROM all_objects
    Also note that historically ODBC has delivered poor performance. I recall many performance tests I've done during the 90's that showed ODBC up to 3x slower and generating more than 4x the network traffic, than native connections. Not too mention using ODBC introduces an additional software layer, which means more moving parts, more complexity, and more failures.
    I have not touched ODBC with the proverbial 10ft pole since - and today, I have even less need to use a clunky software layer like ODBC. And should I be forced to, it will be passthru all the way.

  • New BIOS release - "Updated the ACPI SLIC table"

    Hi.
    Can anybody explain what "Updated the ACPI SLIC table" means in the new released BIOS update for Toshiba Qosmio x505? That explanation is really vague.

    This Microsoft article should give you an idea what it's about.
       You receive an error message when you try to activate Windows Vista or Windows 7 on a computer that ...
    Don't ask me for more..
    -Jerry

  • Updating the standard Database table

    Dear All
    requirement to change the Standard DB table i.e DPR_PROJECT
    regards
    Moderator Message: Put some effort into not only solving your issue but also into framing a proper question. Thread locked
    Edited by: kishan P on Sep 3, 2010 10:29 PM

    HI Jaipai,
    You have to find standard function modules / BAPI / class to update data from that table.
    If you have to change the table's structure, use enhancement to do that.
    Thanks!
    Duy

  • Updating a standard database table

    how to update a standard db table  using t-code
    (without any program)

    To data in standard tables are related to the transaction.
    The data which you are storing through transaction which will be stored in more than one table at a time.
    Its possible to enter the data in one table bye writing the simple code.
    But that is not right way.
    You have to use the BDC or BAPI function module to store the transaction data.
    Regards,
    Madan.

  • Creating new entities through updatable view

    I am trying to create 2 entity records through an updatable view. There is one primary entity which is joined to an another entity (which is an association table).
    The secondary entity is updatable and all it's attributes are updatable. But I get the following exception as soon as setAttribute() is called on the first attribute of the second entity
    SEVERE: oracle.jbo.ReadOnlyAttrException: JBO-27008: Attribute set for FpsgFoId in view object FolderByName failed
    javax.faces.el.EvaluationException: oracle.jbo.ReadOnlyAttrException: JBO-27008: Attribute set for FpsgFoId in view object FolderByName failed
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
         at oracle.adf.view.faces.component.UIXComponentBase.__broadcast(UIXComponentBase.java:1087)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:204)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
    Here is my code
    ViewObject vo = findViewObject("FolderByName");
    Row folder = vo.createRow();
    vo.insertRow(folder);
    Sequence seq = new Sequence("FOLDERS_SEQ", this);
    Number foID = new Number(seq.getValue());
    folder.setAttribute("FoId", foID);
    folder.setAttribute("Name", name);
    folder.setAttribute("Description", description);
    folder.setAttribute("Type", type);
    folder.setAttribute("ParFoId", parFolder);
    folder.setAttribute("OwnerId", owner);
    folder.setAttribute("FpsgFoId", foID); **** fails here ***
    Pranab

    Thanks, but my scenario is little different. I have two entities with many to many association through an association table. Entity at one end of the association already exists. I am trying to create an entity at the other end of the association and the entity for the association record, all in one trasaction through an updatable view. The updatable view spans across the relevant entities.
    ADF is trying to create the association records before creating the record for the main entity and running into foreign key constraint viloation. It should do the inserts in the opposite order.
    Pranab

  • Creating new Tablespace in 10g XE using Database Home Page

    How can I add a Tablespace using the "Database home Page" GUI? I've done this before, but now do not see a link for "Create Tablespace" under the Administration -> Storage icon. I'm logged in as sys.

    use sqlplus to create a new tablespace
    (set your XE environment first)
    (for Linux)
    the environment file envOraXEclient for example) -- modify for your env and different shell, and source the file
    export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
    export TNS_ADMIN=/home/mytnsdirectory
    export TWO_TASK=XE
    export LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
    export PATH=$ORACLE_HOME/bin:${PATH}
    by using sqlplus, create the tablespace (use different size if you want, up to 4gb, you can create smaller, more than one tablespace, etc - this is just an example)
    CREATE SMALLFILE
    TABLESPACE "MYTBLSPC1"
    DATAFILE '/usr/lib/oracle/xe/oradata/XE/mytblspc1.dbf'
    SIZE 2G REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
    LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
    if you want, create a dedicated temporary tablespace for your user/s as well (here is an example)
    CREATE SMALLFILE TEMPORARY TABLESPACE "MYTEMP"
    TEMPFILE '/usr/lib/oracle/xe/oradata/XE/mytemp.dbf'
    SIZE 100M REUSE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1024K
    turn the recyclebin off if you want/need to (I do ;)
    alter system set recyclebin=off;
    change the open_cursors if you want/need to (I do ;)
    ALTER SYSTEM SET open_cursors = 5000 SCOPE=MEMORY;
    ALTER SYSTEM SET open_cursors = 5000 SCOPE=SPFILE;
    ALTER SYSTEM SET session_cached_cursors = 50 SCOPE=SPFILE;
    create a specific user utilizing the tablespaces you created earlier
    CREATE USER "ZAFER" PROFILE "DEFAULT"
    IDENTIFIED BY "zafer" DEFAULT TABLESPACE "MYTBLSPC1"
    TEMPORARY TABLESPACE "MYTEMP"
    ACCOUNT UNLOCK;
    (grants are up to you - and your development / deployment environment)
    GRANT UNLIMITED TABLESPACE TO "ZAFER";
    GRANT "CONNECT" TO "ZAFER";
    GRANT "RESOURCE" TO "ZAFER";
    Edited by: zaferaktan on Sep 4, 2009 10:09 AM

Maybe you are looking for

  • Messed Up Home Button?

    Is it just me and my phone or is the home button just not that responsive. What I mean is with mine, I have to push pressure, because the 1st time usually does not work. So I push it a little "more" the 2nd time around and it works. It bugs me cause

  • DataSourceUserManager bug in oracle 9.0.4

    Hi, We use jaas configured with com.evermind.sql.DataSourceUserManager as a custom user manager provider on Oracle 9.0.4. It works with a datasource that defined in OracleAs datasource. Every thing works fine. When we restart the OC4J instance, the c

  • Preview as default for images

    I use CS2 and suddenly I found that a whole file of jpgs cannot be opened without changing them one by one to the CS2 format. When I go to 'open with' the only option is Preview which is set as the default. How can I change this?????

  • Magic Mouse vs. Magic Trackpad

    I've never owned a laptop, and the few times I used one, I found the trackpad a royal PITA (more accurately, Pain In The Finger/Hand/Wrist). But that was prior to the Magic Trackpad, and I'm wondering if my experience is specific to the types of trac

  • Can't play mov files on iphone 5

    can't open mov files on iphone 5.  updated software to the latest.  restarted phone.  Help!!