Inserting JTable for JDBC swing project in programme.

i,ve a problem to develop an application contains table area
with fixed columns but multiple rows in it.give me a suitable suggestion plz.

http://forum.java.sun.com/thread.jsp?forum=57&thread=271752
Take a look at this thread and please read carefully.
James

Similar Messages

  • WARNING: No saved state for javax.swing.JTable

    Hi All,
    I have a JTable component in my code and I used Netbeans to add swing components. However, I get this warning after I run my app:
    WARNING: No saved state for javax.swing.JTable[jTable1,0,0,329x80,alignmentX=0.0,alignmentY=0.0,border=,
            flags=251658568,maximumSize=,minimumSize=,preferredSize=,autoCreateColumnsFromModel=true,
            autoResizeMode=AUTO_RESIZE_SUBSEQUENT_COLUMNS,cellSelectionEnabled=false,editingColumn=-1,
            editingRow=-1,gridColor=javax.swing.plaf.ColorUIResource[r=128,g=128,b=128],
            preferredViewportSize=java.awt.Dimension[width=450,height=400],rowHeight=16,rowMargin=1,
            rowSelectionAllowed=true,selectionBackground=javax.swing.plaf.ColorUIResource[r=51,g=153,b=255],
            selectionForeground=javax.swing.plaf.ColorUIResource[r=255,g=255,b=255],showHorizontalLines=true,
            showVerticalLines=true]What is the reason of this? If I need to catch this exception, how can I add it with netbeans?
    Edited by: Darryl Burke -- broke a long line into several lines

    Set the name property of your JTable, it's a Netbeans thing, rather than a Java problem. table.setName("MyTable");Have a look at this thread for details: SessionStorage warning while program is running
    Please only post Java related questions here and post Netbeans questions to a netbeans forum/mailing list, thanks.

  • How to store the datas in a .txt file in to a JTable in Java Swing

    Hi sir,
    Here i want to know how to store the data's of a .txt file
    in to a JTable in java swing.
    Where here the .txt file like for eg,spooler.txt is in the server and from there it will come to my client machine what i have to do is to take that .txt file and store the datas of the .txt file
    in a JTable.This is what i want.So pls. do help and provide the code as well.I will be thankful.Since i am involved in a project which involves this it is Urgent.
    Thanx,
    m.ananthu

    You can't just display data from a text file in a JTable. You have you understand the structure of the data so that you can parse the data and create a table model that can access the data in a row/column format. Here is an example of a simple program that does this:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=315172

  • What are the needed tools for JDBC???

    iam new to this field, i want to know what are the required tools for JDBC??
    i know that i need java.sql and javax.sql packages, but how can i get them???
    what about the drivers???
    thnx in advance

    You need to go to the vendor's web site such as Oracle and download the jar file for that particular database. Example: ojdbc14.jar for an oracle database and copy it to the 'lib' folder of your project and then include it with your project. Within that jar file, you will have datasource, preparedStatement, resultSet objects. You will need to read up on how to instansiate the datasource for that database from the vendor's documentation.

  • Java Mapping for JDBC Interface

    Hi,
    please help on java mapping for my jdbc interface.
    my java code for jdbc is:
    Created on May 7, 2008
    TODO To change the template for this generated file go to
    Window - Preferences - Java - Code Style - Code Templates
    package XiMappingDB2.com.xi.test;
    @author miracle
    TODO To change the template for this generated type comment go to
    Window - Preferences - Java - Code Style - Code Templates
    Created on May 2, 2008
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    package com.xi.test;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.util.HashMap;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.MappingTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.StreamTransformationException;
    @author kotla
    To change the template for this generated type comment go to
    Window>Preferences>Java>Code Generation>Code and Comments
    public class NameMerge implements StreamTransformation  {
         private Map param = null;   
         private MappingTrace trace = null;
         public void setParameter(Map param){       
         this.param = param;
         if (param == null) { 
         this.param = new HashMap();
         public void execute(InputStream input, OutputStream output)      
         throws StreamTransformationException {
         AbstractTrace trace = null;     
         String RESULT = new String();
         trace =      
         (AbstractTrace) param.get(             
         StreamTransformationConstants.MAPPING_TRACE);
         try {          
        //Create DOM parser
        DocumentBuilderFactory factory =   
        DocumentBuilderFactory.newInstance();     
        DocumentBuilder builder = factory.newDocumentBuilder();
         //Parse input to create document tree
         Document doc = builder.parse(input);
                    trace.addInfo(doc.toString());
          //          Map the elements          
        Node root = doc.getFirstChild(); // gets the root element
         NodeList children = root.getChildNodes();
          for (int item = 0; item < children.getLength(); item++) {
          if (children.item(item) instanceof Element) {
          root = (Element) children.item(item);
          NodeList ch = root.getChildNodes();
          RESULT = RESULT.concat(ch.item(0).getNodeValue() + " ");
          trace.addInfo(RESULT); }
          catch (Exception e) {           
               trace.addDebugMessage(e.getMessage());      
       //Return the output document
       String document_exit = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:Person2 xmlns:ns0=\"urn:xxxxx.com:test:mapping:lookups\"><RESULT>" 
       + RESULT               
       + "</RESULT></ns0:Person2>";
         insertDB(RESULT);
       try
            output.write(document_exit.getBytes());
             catch (IOException e1) {
            trace.addDebugMessage(e1.getMessage());
    public void insertDB(String DETAILS){
        Statement stmt = null;
        Connection conn = null;
        try {
          conn = getConnection();
          conn.setAutoCommit(false);
          stmt = conn.createStatement();
          stmt.execute("insert into KUMAR(DETAILS) values ('"DETAILS"')");
          //System.out.println ('"DETAILS"');
          conn.commit();
          stmt.close();   
          conn.close();
        } catch (Exception e) {
          System.err.println("Error: " + e.getMessage());
          e.printStackTrace();
      public Connection getConnection() throws Exception {
        String driver = "com.ibm.db2.jcc.DB2Driver";
        String url = "jdbc:db2://172.17.4.24:50000/SAMPLE";
        String username = "miracle";
        String password = "sairam";
        Class.forName(driver);
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    but we are getting the following error:Linkage error occurred when loading class JavaDatabaseApp/XiMappingDB2/com/xi/test/NameMerge (http://FILE2JDBC_US, 7d7b3141-f4d1-11dc-b25e-d5d5c0a80198, -1)
    Start of test
    LinkageError at JavaMapping.load(): Could not load class: JavaDatabaseApp/XiMappingDB2/com/xi/test/NameMerge
    java.lang.NoClassDefFoundError: JavaDatabaseApp/XiMappingDB2/com/xi/test/NameMerge (wrong name: XiMappingDB2/com/xi/test/NameMerge) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170).
    please solve this issue.

    Uday,
    May be you have uploaded class file into external definitions.
    You need to Zip the class file into .jar  and then upload into external definitions of integration repository
    Regards,
    Kiran Bobbala

  • Can anyone advise me how to insert a hyperlink into a project I am using Captivate 5?

    Can anyone advise me how to insert a hyperlink into a project - I am using Captivate 5

    You can use an interactive object such as a click box placed over the top of a text caption, or a button, to link to the URL.  However, these will not strictly-speaking appear identical to hyperlinks.
    If you really want to replicate the rollover appearance of a true HTML text hyperlink, then you might consider the Hyperlink widget from Infosemantics:
    http://www.infosemantics.com.au/adobe-captivate-widgets/hyperlink-interactive/help
    Free trial versions for download hers:
    http://www.infosemantics.com.au/adobe-captivate-widgets/download-free-trial-widgets

  • Looking for a "Super Project" feature

    First, you will have to excuse me if this is the wrong forum for this. I just couldn't find any specific forum for Java project-build/management.
    Now, I'm looking for some sort of a feature/ability/plug-in, especially for Eclipse, which resembles this:
    Super projects - a combination of several projects under the same organizational structure. It doesn't refer to a new technology, nor a new feature of Java. It only refer to a way of organizing your projects.
    A reason to have such thing, in case you were wondering, is to standardize the use of certain projects, all closely-related (technically and logically) to a certain system, but aren't related enough to exist in the same project.
    For an example, let's say we have a certain system. It has a main project, which is the core of the system. Then, we have another project, which allows monitoring our system. It isn't a project that could be under the core-project, as it has too many differences (both technical and logical), but it uses lots of the same libraries, abilities and external resources the core-project uses as well (for example, a jar which allows a more comfortable use of JDBC, or just a configuration file), and of course still logically related to the core-project.
    Therefore, those two projects, the core and the monitor, should be under the same super project - sharing libraries, abilities and external resources.
    So how should it look like? Well, here are several ideas:
    - First of all, a certain way to view those projects as being under the same super-project.
    - An option (and warning-display if possible) of sharing jars. Instead of linking a certain jar to each project separately, a jar will be defined as shared, and could be shared by some or all of the projects in the super-project.
    - Same thing with any other file (such as resource files).
    - A meta-data file, containing information of which projects are in the super-project, what jars (or any other file) are being used, and what's the version of each of those jars.
    - Comfortable save/load of those projects together, and their shared files (nothing more then a super directory with "Projects" directory for the projects in the super project, and a "Shared" directory for all the shared jars and other files).
    I'll repeat myself - I'm not talking about a new technology, but just a feature, or a plug-in.
    So, are you familiar of anything resembling that? or something at least in production stage?

    EyalR wrote:
    Well, I didn't figured how the idea of a super-project, or several combined projects works with Maven. I guess it's because this tool is filled with many options, and there's no good documentation that I've found which simply explains what's every thing is (or maybe I'm just dumb).Having just recently taken the dive into real development with Maven recently (I've been dabbling before), I too have the feeling that the documentation (especially for the rough overview and getting-into-it) is somehow lacking, in many areas. The documentation is much better suited for finding specific information when you already know what exactly you want it Maven to do.
    That being said: I strongly suggest you invest the time to get over that first hurdle, because in my opinion it's definitely worth it.
    Anyway, it seems I'm looking for something more simple and straightforward.Out of curiosity: If it should be simple and straightforward, what artifacts would you expect such a product/technology to produce? What would you use it for?
    Maven uses that big pile of metadata about your project for building your project from source, managing your dependencies, deploying your artifacts to a defined repository, running your tests and many other things as well.
    Having something "simple and straightforward" would almost seem like a waste of effort, because with that kind of meta-data you can do much bigger things.
    Edit: I just remembered [Apache Ivy|http://ant.apache.org/ivy/]: it's a dependency-management task for ant. This means that it handles the same task of a (very small) subset of Maven, but it a lot simpler to use (if you already know and use ant). It doesn't do any sub-projects or anything like that, but might be a more gentle introduction into the world of post-ant build/project/configuration management.

  • Cann't launch the ADF Swing Project

    Hello,
    I have created java-application(swing,adf bc) in Jdev10.1.3, and created the Java Web Start(JNLP) files for the application ,run ant target: sign. it created all files ,build ok.
    but when I run the local.html in the Jdev1013, it open IE window, then I clicke the Launch JClient Link and it asks me to download the local.jsp file or open the file.
    If I download , the file "local.jsp.jnlp" would be saved, if I open, it display beblow:
    <?xml version="1.0" encoding="Big5" ?>
    - <jnlp spec="1.0" codebase="http://127.0.0.1:8991/TestJClient-View-context-root">
    - <information>
    <title>Title</title>
    <vendor>Vendor</vendor>
    <description>My ADF Swing Project</description>
    </information>
    - <security>
    <all-permissions />
    </security>
    - <resources>
    <j2se version="1.3+" />
    <jar href="client.jar" />
    <jar href="mymt.zip" />
    <extension name="common" href="localmt.jsp" />
    </resources>
    <application-desc main-class="test.view.test" />
    </jnlp>
    I review the local.jsp in Jdev1013, find some error "should not exist the element jnlp" about below:
    <?xml version="1.0" encoding="Big5"?>
    <jnlp spec="1.0" codebase="<%= buf.toString() %> ">
    Maybe that is jdev1013 bug.
    Anyone know the reason or how to deal with the error ?
    Thanks

    Hi,
    you are mixing releases here. You start with JClient in JDeveloper 10.1.2 and end up with ADF Swing in 10.1.3. Now what is the release you have the problem with. For 10.1.2 we have a whitepaper explaining how to use Java WebStart. We didn't upgrade this paper for 10.1.3, but I get Web Start deployment working when i tried it last time in JDeveloper 10.1.3.
    Note that no file should be downloaded to teh client and instead the JSP file should be executed to generate the JNLP file
    Frank

  • Problem of loading the MS SQL Server 2000 driver for JDBC

    Thanks for your reply.
    I have already tried to give the full class path of .jar files to the System and User Variables but received the same error. I am doing BCA and developing my very first Project on Java.
    Please, tell me one thing. When I had installed MS SQL Server 2000 at my system first time then the 3 JAR files were present in the lib folder and all my codings of connectivity were working properly. Then due to some reasons, I had to format C drive and installed the MS SQL Server 2000 again then in the lib folder the 3 JAR files were not there. How it has happened? Then, I installed the downloaded driver of MS SQL Server 2000 for JDBC 1.4 then the JAR files were installed in the related downloaded driver folder. I manually copied them to the lib folder of MS SQL Server and gave that path to the Classpath of System and User Variables, but it didn't work.
    I am not understanding the reason that The Software which worked previously is not working correctly in second time of installing.
    I am using command line to develop my stand-alone project. Please help me.

    Don't bother with the System CLASSPATH, more often than not, it is not even used.
    When running from an IDE, set the project's library preferences.
    When running from a web container/application server configure the applications libraries in the server/container, see it's documentation.
    When running an applet, configure the [ codebase and/or archive |http://java.sun.com/docs/books/tutorial/deployment/applet/html.html] tags properly.
    When running from the command line with the [ "-cp" |http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html] option, the System CLASSPATH is ignored.
    When running from the command line with the "-jar" option, both the System CLASSPATH path and the "-cp" option are ignored, configure the [manifest file|http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html] properly.
    When running any other way, the System CLASSPATH might be used.

  • Problem of loading the MS SQL Server 2000 Driver for JDBC 1.4.1

    Thanks for your reply.
    I have already tried to give the full class path of .jar files to the System and User Variables but received the same error. I am doing BCA and developing my very first Project on Java.
    Please, tell me one thing. When I had installed MS SQL Server 2000 at my system first time then the 3 JAR files were present in the lib folder and all my codings of connectivity were working properly. Then due to some reasons, I had to format C drive and installed the MS SQL Server 2000 again then in the lib folder the 3 JAR files were not there. How it has happened? Then, I installed the downloaded driver of MS SQL Server 2000 for JDBC 1.4 then the JAR files were installed in the related downloaded driver folder. I manually copied them to the lib folder of MS SQL Server and gave that path to the Classpath of System and User Variables, but it didn't work.
    I am not understanding the reason that The Software which worked previously is not working correctly in second time of installing.
    I am using command line to develop my stand-alone project. Please help me.

    Don't bother with the System CLASSPATH, more often than not, it is not even used.
    When running from an IDE, set the project's library preferences.
    When running from a web container/application server configure the applications libraries in the server/container, see it's documentation.
    When running an applet, configure the [ codebase and/or archive |http://java.sun.com/docs/books/tutorial/deployment/applet/html.html] tags properly.
    When running from the command line with the [ "-cp" |http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html] option, the System CLASSPATH is ignored.
    When running from the command line with the "-jar" option, both the System CLASSPATH path and the "-cp" option are ignored, configure the [manifest file|http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html] properly.
    When running any other way, the System CLASSPATH might be used.

  • Problem while inserting data for some datatypes in Oracle 10g

    Hi
    I was trying to insert data in database for all the data types defined in Oracle 10g.
    I was successful in maximum cases.
    I was not able to insert data for following datatypes:
    1 Long varraw
    2 string
    3 varraw
    4 varnum
    5 charz
    6 unsigned int
    7 native double
    8 native float
    Please put some light on it.
    Thanks,
    Gyanendra

    Hi Subin,
    You can try couple of things.
    If your data is less than 32767, you can pass it to stored procedure and change it to clob type like
    PROCEDURE CLOBQUERY
         Param     IN     CLOB,
    and you can call Procedure
    EXECUTE CLOBQUERY '[Param.1]'
    If your data is around than 1000000(32767*32), you can break the data in length of 32767 and pass it to param 1 to 32 like
    EXECUTE CLOBQUERY '[Param.1][Param.2][Param.3]..[Param.32]'
    Finally you can try to update jdbc drive.
    check the link Link: [JDBC Limitation|http://confluence.atlassian.com/display/JIRA/UsingOracle10gdriverstosolvethe4000character+limitation]

  • Error establishing socket (Microsoft SQL Server 2000 Driver for JDBC)

    I tray connect to MS-SQL2000 using JDeveloper and retrieve an error: "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.[Microsoft][SQLServer 2000 Driver for JDBC]PC160832\NCI_DBA_01"
    I followed the steps:
    1 - Install the JDBC Driver for MS-SQL2000
    2 - Create a new AddJavaLibPath :"AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib"
    3 - Specify Default Project Libraries: "msbase.jar, msutil.jar and mssqlserver.jar"
    4 - Create a new connection: "Java class name: com.microsoft.jdbc.sqlserver.SQLServerDriver" "URL: jdbc:microsoft:sqlserver://PC160832\NCI_DBA_01:1433;SelectMethod=cursor"
    5 - Retrieve the error: "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.[Microsoft][SQLServer 2000 Driver for JDBC]PC160832\NCI_DBA_01"

    Were you able to resolve this? If so could you tell me how. I have the same problem.
    Thanks!!!

  • Multiple selection in JTable for deletion

    Dears,
    I'm using Jdeveloper 9.0.3.3 on 8.1.7 Oracle DB.
    I noticed that when a JTable is bound to a View object ==> only one row can be selected.
    My situation -which I think is very common- I have a screen with JTable where I can edit a row and commit my updates or select multiple selection in JTable and delete them at once ; thats what I need.
    It is very like the test of any application module but allow multiple selection and deletion in JTable for user's selected rows.
    How this could be done in JClient?
    Thankx in advance.

    Thanks for your suggestions! They both would work as workarounds, I think. I tried another way:
    Following code changes a TableBinding bound JTable's selection model to Multi select (thanks to Shailesh!!).
    void setMultiSelectionModel(JTable tbl)
    class MultiSelectionListListener implements javax.swing.event.ListSelectionListener
    ListSelectionModel defSelModel;
    MultiSelectionListListener(ListSelectionModel model)
    defSelModel = model;
    public void valueChanged(javax.swing.event.ListSelectionEvent e)
    if (!e.getValueIsAdjusting())
    ListSelectionModel listModel = (ListSelectionModel)e.getSource();
    int leadIndex = listModel.getLeadSelectionIndex();
    if (leadIndex == listModel.getAnchorSelectionIndex()
    && leadIndex == listModel.getMaxSelectionIndex()
    && leadIndex == listModel.getMinSelectionIndex())
    //change currency on the bound iterator only if
    //one row is being selected.
    defSelModel.setSelectionInterval(leadIndex, leadIndex);
    ListSelectionModel newModel = new DefaultListSelectionModel();
    newModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    newModel.addListSelectionListener(new MultiSelectionListListener(tbl.getSelectionModel()));
    tbl.setSelectionModel(newModel);
    This fixes the bug if you select some rows and then select a row before the first selected one. Seems to work great.

  • Question for everyone: Swing Design Patterns

    I've used kodo for many web projects, but I am currently looking at using it
    for a swing application and am having a hard time figuring out the best way
    to use it.
    My original attempt used a singleton PersistenceManager for the entire
    application that always had a running transaction. When the application
    started, the pm was created, and currentTransaction.begin() was called.
    Whenever anything was done that needed to change the JDO-persisted business
    objects, I would simply make the necessary method calls to the business
    objects. Whenever the user wanted their changes to be saved (committed)
    there was a "File->Save All" menu item that did a
    currentTransaction.commit() then a currentTransaction.begin(). This seemed
    very easy to do, and I could even bind JTextFields etc. directly to
    getters/setters and all data to and from the swing app was nice and easy. I
    see two problems with this, however:
    1) The user needs to remember to call "file->save all" from time to time,
    which is not always done
    2) It makes an all-or-nothing approach to saving data. You cannot have a
    "ok/cancel/apply" button on each window that commits only the data changed
    in that window.
    I could get rid of the "file->save all" necessity by having it auto-commit
    after certain things are done. The trouble is, I think that would probably
    be after each text field etc. looses focus and would lead to a lot of commit
    overhead as well as default fields that shouldn't really be committed to the
    database being committed.
    My next attempt was to try to make the entering/editing of data independent
    from the gets/sets/business methods on the business objects. In this
    attempt, there is still a singleton pm, but no on-going transaction. On
    each "OK" button click, transactions are begun, the information set in the
    swing components are transferred to the business objects, and the
    transaction is committed. Before long, however, it got very unwieldy to try
    to manually track how swing controls map to business object calls. I did
    find a nice pattern where there is a "BufferedValueHolder" object that you
    could use for storing information, and when a passed variable would change
    values (which you would change on your "OK" button), then it would
    automatically send the new value to the underlying business objects which
    would then be committed. This helped a lot on simple properties that can be
    modified, but fell apart when you had more complex business logic such as
    "when they hit the approve button, the approver needs to be set to the
    logged in user, the approval date must be set to the current date, and the
    item must be removed from the unapproved list". Since I can't call the
    ..approve() method on the business object when the approve button is hit
    (since it is not running in a transaction), I must move/duplicate all the
    logic of which swing fields must be changed into the UI layer, in which it
    doesn't belong.
    That's where I am so far. I thought about trying to create a new pm for
    each window/transaction, but I think that would lead to too many "this
    object not managed by this PM" exceptions. I've looked at the swing example
    in the Kodo download, but the example does not seem to fit a more complex
    application than the one provided. I also checked out JDOCentral.com, but
    couldn't find anything in their code exchange. Any suggestions would be
    very welcome.
    Nathan

    Thanks for the quick response!
    What do you mean by a DataSource class? For example, suppose you have the
    following PC class:
    public class Task {
    private Integer id;
    private String name;
    private String approvedBy;
    private Date approvalDate;
    ..... (getters and setters)
    public void approve(String approver) {
    approvedBy = approver;
    approvalDate = new Date();
    Would you have a DataSource class that is a duplicate of Task except that
    getters and setters throw properyChangedEvents? Does it help to have the
    DataSource object extend the PC object? Where would you put the approve()
    method? On the Task or the TaskDataSource object? How does the DataSource
    object know to save its information to the base Task object, by registering
    with the PM?
    I like the idea of not starting a transaction untill the DataSource changes.
    Does refreshing each PC simply require a call to PM.refresh(), or does it
    take more than that?
    Nathan
    "Alex Roytman" <[email protected]> wrote in message
    news:[email protected]...
    We use:
    - single PM
    - we use DataSource concept (proxy to percistent classes which fires
    property change events on state change) to facilitate MVC
    - Transaction started and commited per dialog box. It is started by
    listeners attached to DataSource class so we do not start transactionbefor
    each opening of a dialog box bu only when attempt is made to make a change
    to state of a PC
    - Dirtiest part is thet we have to refresh each PC instance (or sme time a
    graph of instances) before we present it for editing
    Have fun
    Alex
    "Nathan Voxland" <[email protected]> wrote in message
    news:[email protected]...
    I've used kodo for many web projects, but I am currently looking at
    using
    it
    for a swing application and am having a hard time figuring out the bestway
    to use it.
    My original attempt used a singleton PersistenceManager for the entire
    application that always had a running transaction. When the application
    started, the pm was created, and currentTransaction.begin() was called.
    Whenever anything was done that needed to change the JDO-persistedbusiness
    objects, I would simply make the necessary method calls to the business
    objects. Whenever the user wanted their changes to be saved (committed)
    there was a "File->Save All" menu item that did a
    currentTransaction.commit() then a currentTransaction.begin(). Thisseemed
    very easy to do, and I could even bind JTextFields etc. directly to
    getters/setters and all data to and from the swing app was nice and
    easy.
    I
    see two problems with this, however:
    1) The user needs to remember to call "file->save all" from time to
    time,
    which is not always done
    2) It makes an all-or-nothing approach to saving data. You cannot havea
    "ok/cancel/apply" button on each window that commits only the datachanged
    in that window.
    I could get rid of the "file->save all" necessity by having itauto-commit
    after certain things are done. The trouble is, I think that wouldprobably
    be after each text field etc. looses focus and would lead to a lot ofcommit
    overhead as well as default fields that shouldn't really be committed tothe
    database being committed.
    My next attempt was to try to make the entering/editing of dataindependent
    from the gets/sets/business methods on the business objects. In this
    attempt, there is still a singleton pm, but no on-going transaction. On
    each "OK" button click, transactions are begun, the information set in
    the
    swing components are transferred to the business objects, and the
    transaction is committed. Before long, however, it got very unwieldy totry
    to manually track how swing controls map to business object calls. I
    did
    find a nice pattern where there is a "BufferedValueHolder" object thatyou
    could use for storing information, and when a passed variable wouldchange
    values (which you would change on your "OK" button), then it would
    automatically send the new value to the underlying business objectswhich
    would then be committed. This helped a lot on simple properties thatcan
    be
    modified, but fell apart when you had more complex business logic such
    as
    "when they hit the approve button, the approver needs to be set to the
    logged in user, the approval date must be set to the current date, andthe
    item must be removed from the unapproved list". Since I can't call the
    .approve() method on the business object when the approve button is hit
    (since it is not running in a transaction), I must move/duplicate allthe
    logic of which swing fields must be changed into the UI layer, in whichit
    doesn't belong.
    That's where I am so far. I thought about trying to create a new pm for
    each window/transaction, but I think that would lead to too many "this
    object not managed by this PM" exceptions. I've looked at the swingexample
    in the Kodo download, but the example does not seem to fit a more
    complex
    application than the one provided. I also checked out JDOCentral.com,but
    couldn't find anything in their code exchange. Any suggestions would be
    very welcome.
    Nathan

  • DB Insert failed through JDBC Adapter

    Hi all,
    My system is on the latest patches of XI3.0 SP9. I am trying to insert some records into a database through JDBC adapter. The XML arriving at JDBC adapter is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns:MaterialDataUpdate_Msg xmlns:ns="http://acsis.com/ManufacturingManagement">
    <MaterialData>
    <TMP_MAT_SERIAL action="INSERT">
      <table>TMP_MAT_SERIAL</table>
      <access>
      <MATNO>0000000012</MATNO>
      <BATCH>32151</BATCH>
      <ITM_SERIAL>453176587769</ITM_SERIAL>
      <WEIGHT>12.34</WEIGHT>
      <T_TIME>2005-01-21 13:21:34.432</T_TIME>
      </access>
      </TMP_MAT_SERIAL>
      </MaterialData>
      </ns:MaterialDataUpdate_Msg>
    The connection to the database looks ok. My JDBC adapter config is pointing to "jdbc:microsoft:sqlserver://sapsrv03:1433;databaseName=JDE".
    In rwb, I got the following error:
    Unable to execute statement for table or stored procedure. "TMP_MAT_SERIAL" due to java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'TMP_MAT_SERIAL'.
    I have checked the database "JDE", and the table 'TMP_MAT_SERIAL' does exist.
    Does anyone have any idea about this error?
    Thanks a lot for helping!
    Hart

    Hi Hart Liu,
    My system is on the latest patches of XI3.0 SP9. I am trying to insert some records into a database through JDBC adapter.
    We have been facing with problem XSD structure in the jdbc side. We r manually created XSD structure. In the adapter engine we don’t have any action item. In u r mail
    U r structure contains action attribute.
    Can u plz help me out to generate the right XSD structure?
    We have one more doubt, is there any automatically structure-generated option? plz let us know.......
    We r waiting for u r reply....
    Plz help me!!!!!!!!
    Regards,
    Anil

Maybe you are looking for

  • Windows 7 64-bit: Switchable graphics and Ricoh card reader problem

    Hi guys, Two problems with my laptop. I'm using a T400, previously installed with Windows Vista Business 32-bit. Switchable graphics worked well until I formatted and installed Windows 7 Pro 64-bit (I got the RTM through MSDNAA). Now, Windows can onl

  • New hard drive and old ipod

    I lost my hard drive (and no I hadn't backed up my music files). Is there any way for me to transfer music from my ipod to my PC?

  • Bought a blue tooth keyboard and I can't get it to connect to the ipad

    I bought a keyboard from bro ketone to use with the iPad. I can't get it to connect on the Bluetooth. Does anyone use this product with their iPad?

  • Open fails when using DB_DIRECT_DB

    Hi, I'm trying to use the DB_DIRECT_DB flag to bypass the filesystem cache for some experiments I'm running (to clarify results, not for performance reasons). I'm using BDB 4.5.20 (C++ API) with kernel version 2.6.17-1.2142_FC4smp on Fedora Core 4. I

  • Struts Action threading model bottleneck

    Hi, Struts Action classes are only instantiated once. Then the controller servlet routes all perform/execute calls through the single instantiated Action class. Does this create a performance bottleneck? Any insights would be helpful. Thanks