Using java to do inserts in ADF BC

Hi this most probably not a new problem but i have been looking and i did not
really find what i was hoping for.
What i would like to do is not that complexe but i cannot find the right code to do it
i want to be able with java only to extract data from a table
and modify it to be able to insert it into another table.
i want the code for the extraction and for the insertion.
i looked to the book "Developer’s Guide For Forms/4GL Developers"
i was looking at the chapter/section 8.5 and this might do some of the job but not all of it
Will i have to code all the methods individually inside all the java files for each view objects in which i want to insert or select?
Regards,
Carl

Hi,
I think you have 2 options here
1 - create two EO and VO on top. A VO is an iterator and as such you can search nd iterateover a collection of data to obtain Row by Row and modify it. The insert the new Row into the second VO
2 - get a handle to the Transaction on the AM (getTransaction) and issue a prepared statement to obtain the rowset the good old Java way and use similar to update the next table
Sorry for not having the exact code by hand
Frank

Similar Messages

  • How can I using java bean to insert new record

    Hi everybody,
    I'd some problem when I insert a record using java bean. When insert a record, the resultset executeUpdate return 0 anc cannot add record to database. Would you please tell me what's wrong in my code?
    java bean
    package miniproj;
    import java.sql.*;
    public class Register{
    private String sql;
    private String username;
    private String usertype;
    private String password;
    private String blocknum;
    private int floornum;
    private String owner;
    private int rows;
    private String s;
    // set parameter to database
    public int setMember(){
    try{
    //load database driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Get a connection to the database
    Connection sqlConn = java.sql.DriverManager.getConnection("jdbc.odbc:WFBS");
    // Get a statement from the connection
    Statement sqlStmt = sqlConn.createStatement();
    sql = "INSERT INTO USERS(user_name, password) VALEUS ('aaa', 'aaa')";
    // sql = "INSERT INTO USERS(user_name, password) VALEUS (" + user_name + "," + password + ")" ;
    rows = sqlStmt.executeUpdate(sql);
    // sqlRst.close();
    sqlStmt.close();
    sqlConn.close();
    catch(SQLException se){
    catch(Exception e){
    return rows;
    // set user name method
    public void setUsername(String name){
    username = name;
    // set passwrod method
    public void setPassword(String pwd){
    password = pwd;
    // set block num mehtod
    public void setBlockNum(String block){
    blocknum = block;
    // set floor num method
    public void setFloorNum(int floor){
    floornum = floor;
    // set owner method
    public void setOnwer(String own){
    owner = own;
    // get user name method
    public String getUsername(){
    return username;
    // get password method
    public String getPassword(){
    return password;
    jsp code
    <%@ include file="Header.jsp" %>
    <%@ page errorPage="Error.jsp" %>
    <jsp:useBean id="register" class="miniproj.Register" />
    <jsp:setProperty name="register" property="*" />
    User name : <%=register.getUsername()%><br>
    Password : <%=register.getPassword()%><br>
    <%
    int i = register.setMember();
    out.println(i);
    %>
    Thanks a lot
    Chris

    Seems to me that executeUpdate() would throw an SQLException, which in turn would get caught by your empty catch. The SQL keyword VALUES is misspelled. Put a 'se.printStackTrace()' in your catch to confirm this.

  • Inserting a record in database using Java

    Hello All,
    i have connected a Java Application to the SAP BO Database using DI API and would like to insert a record in the demo database without using an SQL Query "Insert into table1...." but using the following snippet though i dont know if am using the right classes :
                                    ICompany company = conn.getCompany();
                                     IItems items = SBOCOMUtil.newItems(company);
                        items.setItemCode("124");
                        items.setItemName("VXC");
                        items.setItemsGroupCode(1);
                        items.setItemType(0);
                        items.add();
    What i am trying to do here is insert a new record but i dont know where i should mention the table name for e.g. there is table called OITM in the demo database from BO where i would like to create a new Item.
    Could anyone help me here.
    Regards,
    Amit Hingher

    Hi Amit,
    You don't need to reference the destination tables as there is a class for each data object in the DI API and the data tables associated with the object are hardcoded in the class.
    The Items class is the correct one for adding item master data (ie data in OITM, OITW etc).
    I'm not very familiar with these Java objects but I think the add method should return an integer value (as it does with the COM objects used by .NET). If the return value is zero then the add was successful. If the add failed then you'll get a non-zero value which is the SBO error code.
    Kind Regards,
    Owen

  • How to insert text in the middle of an existing textfile using java

    Hi,
    How to insert text in the middle of an existing textfile using java i/o streams??

    Mickie wrote:
    I shudn't delete the file...Then you will have the old file and the new file - do you want that?
    and I have to insert text not only at a single place ....got to do at many places in the text file!!then extrapolate on the procedure outlined in reply #1 .

  • As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 also how we can insert,update,delete records in list using ECMA script.

    As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 step by step also how we can insert,update,delete records in list using ECMA script.
    Thanks and Regards, Rangnath Mali

    Hi,
    According to your post, my understanding is that you want to use JavaScript to work with SharePoint list.
    To create list items, we can create a ListItemCreationInformation object, set its properties, and pass it as parameter to the addItem(parameters) function
    of the List object.
    To set list item properties, we can use a column indexer to make an assignment, and call the update() function so that changes will take effect when you callexecuteQueryAsync(succeededCallback,
    failedCallback). 
    And to delete a list item, call the deleteObject() function on the object. 
    There is an MSDN article about the details steps of this topic, you can have a look at it.
    How to: Create, Update, and Delete List Items Using JavaScript
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Insert multiple records into Oracle using Java

    Hi,
    Has anyone tried to insert multiple records into an Oracle table from Java? I have my data in a Java collection.Can I send a Java Collection to an Oracle Package as a PL/SQL Table Type? My problem is I dont want to instantiate a CallableStatement object everytime I do an insert. Instead I want to do that only once and then insert multiple records in one operation.
    Any suggestions will be appreciated,
    Thanks,
    Alex

    Hi Mensa,
    I went thru the code example in your book in chapter 8 (downloaded it from OTN). It looks like the java code for "public class myPLSQLIndexTab" might be a java stored procedure stored in the oracle database?
    Pardon my ignorance because I've never worked on java code in the oracle database itself but how would I call such a program outside the oracle database? For example say I have a batch job that downloads data from a webservice and that batch job is written in java and its sitting on a batch server somewhere on the network. But the java program that inserts data into the database is sitting in the oracle database (also somewhere in the same network). How can the java code sitting on the batch server talk to the java code sitting on the oracle server? Is it the same as calling a pl/sql package using CallableStatement?
    Thanks
    Alex

  • How to use Java Script in jspx pages of ADF Faces?

    I wanna invoke an Applet in a jspx using Java Script...
    How can I do this? :)

    check my other post..that's to know how to use js in jsf pages...not to invoke applet..
    Re: how to Add inline JavaScript to a Page 11G

  • I am trying to use java  file as Model layer and jsf as presentation layer

    I am trying to use java file as Model layer and jsf as presentation layer and need some help
    I successfully get the value of h:outputText from java file by doing simple binding operation but I am facing problems when I am trying to fill h:dataTable
    I create java file
    package oracle.model;
    import java.sql.;*
    import java.util.;*
    *public class TableBean {*
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    *public List getperInfoAll() {*
    perInfoAll.add(0,new perInfo("name","username","blablabla"));
    return perInfoAll;
    *public class perInfo {*
    String uname;
    String firstName;
    String lastName;
    *public perInfo(String firstName,String lastName,String uname) {*
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    *public String getUname() {*
    return uname;
    *public String getFirstName() {*
    return firstName;
    *public String getLastName() {*
    return lastName;
    right click on the file and choose 'create data control'
    then i wrote the jsf file:
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<f:view>*
    *<h:dataTable id="dt1" value="#{bindings.perInfoAll}"*
    var="item" bgcolor="#F1F1F1" border="10"
    cellpadding="5" cellspacing="3" rows="4" width="50%"
    dir="LTR" frame="hsides" rules="all"
    *>*
    *<f:facet name="header">*
    *<h:outputText value="This is 'dataTable' demo" id="ot6"/>*
    *</f:facet>*
    *<h:column id="c2">*
    *<f:facet name="header">*
    *<h:outputText value="First Name" id="ot1"/>*
    *</f:facet>*
    *<h:outputText style="" value="#{item.firstName}"*
    id="ot2"/>
    *</h:column>*
    *<h:column id="c4">*
    *<f:facet name="header">*
    *<h:outputText value="Last Name" id="ot9"/>*
    *</f:facet>*
    *<h:outputText value="#{item.lastName}" id="ot8"/>*
    *</h:column>*
    *<h:column id="c3">*
    *<f:facet name="header">*
    *<h:outputText value="Username" id="ot7"/>*
    *</f:facet>*
    *<h:outputText value="#{item.uname}" id="ot4"/>*
    *</h:column>*
    *<f:facet name="footer">*
    *<h:outputText value="The End" id="ot3"/>*
    *</f:facet>*
    *</h:dataTable>*
    *</center>*
    *</af:document>*
    *</f:view>*
    but nothing is appear in my table
    I know that there is something wrong in calling the binding object
    I need help pls and where can i find some help to deal with another tag types
    thanks

    i dragged the "perInfoAll" from my "Data Controls" and choosed adf table (even I know that new table with adf tags well be generated and i want table with jsf tags)
    and this code is generated
    *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"*
    *"http://www.w3.org/TR/html4/loose.dtd">*
    *<%@ page contentType="text/html;charset=UTF-8"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>*
    *<f:view>*
    *<af:document id="d1">*
    *<af:messages id="m1"/>*
    *<af:form id="f1">*
    *<af:table value="#{bindings.perInfoAll1.collectionModel}" var="row"*
    *rows="#{bindings.perInfoAll1.rangeSize}"*
    *emptyText="#{bindings.perInfoAll1.viewable ? 'No data to display.' : 'Access Denied.'}"*
    *fetchSize="#{bindings.perInfoAll1.rangeSize}"*
    *rowBandingInterval="0"*
    *selectionListener="#{bindings.perInfoAll1.collectionModel.makeCurrent}"*
    *rowSelection="multiple" id="t1">*
    *<af:column sortProperty="uname" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.uname.label}"*
    *id="c1">*
    *<af:inputText value="#{row.bindings.uname.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.uname.label}"*
    *required="#{bindings.perInfoAll1.hints.uname.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.uname.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.uname.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.uname.tooltip}"*
    *id="it3">*
    *<f:validator binding="#{row.bindings.uname.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="firstName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.firstName.label}"*
    *id="c2">*
    *<af:inputText value="#{row.bindings.firstName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.firstName.label}"*
    *required="#{bindings.perInfoAll1.hints.firstName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.firstName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.firstName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.firstName.tooltip}"*
    *id="it2">*
    *<f:validator binding="#{row.bindings.firstName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="lastName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.lastName.label}"*
    *id="c3">*
    *<af:inputText value="#{row.bindings.lastName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.lastName.label}"*
    *required="#{bindings.perInfoAll1.hints.lastName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.lastName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.lastName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.lastName.tooltip}"*
    *id="it1">*
    *<f:validator binding="#{row.bindings.lastName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *</af:table>*
    *</af:form>*
    *</af:document>*
    *</f:view>*
    but when run it i see the following errors
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    :(

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • How to compare 2 dates in SQL Server 2000 DB using Java?

    How do you compare 2 dates in SQL Server 2000 DB using Java?
    Let's say we have two fields: Date Reported and Target Finish Date.
    Date Reported is 09-10-2004 09:55:55: PM
    Target Finish Date is 09-12-2004 11:59:59: PM
    What i want to happen is i want to convert both dates to days and get the difference of the two.
    can SQL Server 2000 DB do this?

    it doesnt wrk.
    ok here's what i did:
    iv tested a simple code for this case.
    I created a table name tblDate which has 3 columns namely date_ID, date_From (datatype datetime), date_To (datatype datetime).
    I inserted 1 row: date_ID has the value 1, date_From has the value 10/22/2004, and date_To has the value 10/24/2004.
    i run the java code below:
    int days = 0;
              String query = "SELECT date_From, date_To cast(date_From-date_To AS int) AS Diff FROM tblZoo WHERE date_ID = '1'";
              try
                   DBConnect db = new DBConnect();
                   db.openCon();
                   ResultSet rs = db.execute(query);
                   while(rs.next())
                        days = rs.getInt("Diff");
                   db.closeCon();                         
              catch (Exception ex)
                   System.out.println("Error on Execution: " + ex);
              return days;___________
    an error occurred: Error on Execution: java.lang.nullpointerexception

  • How to read a text file using Java

    Guys,
    Good day!
    Please help me how to read a text file using Java and create/convert that text file into XML.
    Thanks and God Bless.
    Regards,
    I-Talk

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

  • Best option to push Mass data using Java API

    Hi All,
    Can any one let me know how Java API push data to MDM? Is it a good option when ti comes to perfromance point of view? We have around 2000/5000 records to be imported every time using Java API and wondering what would be best way to acheive this using Java API?
    Is java API is best option than Web services?
    Thanks
    Rajeev

    Rajeev,
    It is perfectly fine to use API to push data into MDM, you just need to make sure that your API does all those tasks which import manager does by default. For example, it should know when to insert and when to update. if an error happens during insertion of record, you should be able to notify the users.
    Having said that, where does the number 2000/5000 comes in? will you be creating users in batch and then invoke MDM API to store these in a single shot or willl it be a delta insert/update from Java to MDM?
    Thanks
    Aamir

  • BPM 11g integration with UCM11g using Java Enbedded acitivity

    Hi Friends,
    Can anyone throw some idea how to integration with BPM11g and UCM11g
    We need to have a java code using Java Enbedded acitivity.
    1) How to Connect to UCM 11g using java code any sample Java Embedded Code( we are connecting through RIDC)
    2) How to Fetch the document from UCM using RIDC.
    3) How to Close the Connection.
    Hi friends,
    My requirement was Using BPEL JAva Embedded Acitivity need to connect UCM by RIDC. Got SCAC exception. I could solve this today 3/12/2012... refer below link
    Re: SCAC-50012 Got this exception when using BPEL Java Embedded Activity
    But I have the actual thing.. as per my post..
    Now I need to fetch the doc i.e.,
    In UCM we have pdf documents i need to Download that document and show it in ADF UI using Java Embedded Activity.
    Ie., Using Java Code I need to Download and Decode the PDF file using Java Embedded Activity after Connection with UCM. Save as a file in Local Machine then I need to Encode ads PDF and Show it to ADF UI.
    Please experts its Quite Urgent!!
    ThankQ!!
    Regards,
    Pavan
    Edited by: BPM Fresher on Dec 3, 2012 8:12 PM

    Hi experts...
    Any solution for this.. Can any one help me on this...
    Regards,
    Pavan

  • Mapping using Java Coding

    I've got a big trouble. First, I'm trying to do mapping using Java Coding based on the TopLink Developer's Guide.
    I'm using a Employee's Table as usual, but here is the problem, I can not do inserting on the database after I do mapping. As a note, there is no error compile and also I can do the session login already.
    Employee.java
    public class Employee extends oracle.toplink.sessions.Project{
         private Long id;
         private String fnama;
         private String lnama;
    public Employee() {
    setName("ObjectTab");
    applyLogin();
    addDescriptor(empDesc());
    conformAllDescriptors();
    public String getFnama() {
         return this.fnama;
    public String getLnama() {
         return this.lnama;
    public void setFnama(String fnama) {
         this.fnama = fnama;
    public void setLnama(String lnama) {
         this.lnama = lnama;
    public void applyLogin() {
    DatabaseLogin login = new DatabaseLogin();
    // use platform appropriate for underlying database
    login.usePlatform(
    new oracle.toplink.platform.database.oracle.Oracle9Platform());
    login.setDriverClassName("oracle.jdbc.OracleDriver");
    login.setConnectionString("jdbc:oracle:thin:localhost:1521:pusat");
    login.setUserName("tryo");
    login.setEncryptedPassword("a, ENCRYPTED");
    // Configuration Properties
    setDatasourceLogin(login);
    public ClassDescriptor empDesc() {
    ObjectRelationalDescriptor descriptor = new ObjectRelationalDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setTableName("EMPLOYEES");
    descriptor.setStructureName("EMPLOYEE_T");
    descriptor.setPrimaryKeyFieldName("ID");
    descriptor.addFieldOrdering("ID");
    descriptor.addFieldOrdering("F_NAME");
    descriptor.addFieldOrdering("L_NAME");
    descriptor.addDirectMapping("id", "OBJECT_ID");
    descriptor.addDirectMapping("fnama", "F_NAME");
    descriptor.addDirectMapping("lnama", "L_NAME");
    return descriptor;
    Main Class:
    protected String getSessionsXmlPath() {
    return "sessions.xml";
    protected String getSessionName() {
    return "Session";
    protected void createSession() {
    XMLSessionConfigLoader loader = new XMLSessionConfigLoader(getSessionsXmlPath());
    SessionManager mgr = SessionManager.getManager();
    session = (DatabaseSession)mgr.getSession(loader, getSessionName(), Thread.currentThread().getContextClassLoader(), true, true);
    public static void closeSession(){
    SessionManager.getManager().destroyAllSessions();
    session = null;
    private void jButton1_actionPerformed(ActionEvent e) {
    Employee myEmp = new Employee();
    createSession();
    private void jButton2_actionPerformed(ActionEvent e) {
    Employee theEmp = new Employee();
    UnitOfWork uow = session.acquireUnitOfWork();
    try{
    theEmp.setFnama("A");
    theEmp.setLnama("B");
    uow.commit();
    }finally{
    uow.release();
    For everybody who already knows the solution, please reply as soon as possible. Because I really need this solution to finish my last final project.
    Thanks

    When you create a new instance you must register it with the UnitOfWork in order to have the new entity persisted.
    Employee theEmp = new Employee();
    UnitOfWork uow = session.acquireUnitOfWork();
    theEmp.setFnama("A");
    theEmp.setLnama("B");
    uow.registerObject(theEmp);
    uow.commit();
    Doug

  • How to use java integrate with ondemand

    Hi All,
    As i'm new to integration, can anyone help me to use java integrate with ondemand that inserts some records in ondemand and deletes some records from ondemand in secheduled interval basis.?
    Thanks in advance..!
    regards
    sowm

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

Maybe you are looking for

  • Crystal report not showing correctly in firefox after windows update

    From the past six months, crystal reports has been displayed without the print toolbar and the formatting is completely lost in firefox. Previously we found that when we uninstall the windows updates KB2836942, KB2836943, KB2836946, KB2836947, the pr

  • PO Approval Email Notifications

    Hi, I customized Standard Printed Purchase Order Report and it is working fine, generating PDF output also with the help of XML Publisher. Now when a PO is approved from PO Approval . Then Standard Purchase Order Report is send to supplier Email addr

  • Reading from a server

    I'm supposed to read the following C struct from a server struct query_type{ int flag; int query_a; int query_b; char next pass[30]; typedef struct query_type t_query; I tried Socket s = new Socket( serverName, serverPort ); DataInputStream dis = new

  • Drop down menu doesn't work

    I've created a movie clip with the first frame as button (action: stop), then on roll over of button, it will go to and play from frame 2 onwards, which contains the fly out buttons (action on last frame of the movie clip: stop) When I export, the bu

  • X2 photos in raw format

    Hi Whenever I take photos its in nrw format and get to jpg format after a long time sometimes 1 day. Please help