db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lily Wei <lily...@yahoo.com>
Subject Re: Hibernate 3 Outer Join Problem
Date Wed, 28 Jul 2010 05:23:52 GMT
Hi umpirsky:
    I am not sure whether this will solve your problem.
However, will using two parameters work better?

    For example:
            String insertsql = "insert into testdbsize (name, address) values 
(?,
?)";
            PreparedStatement insertFirst = cs1.prepareStatement(insertsql, 
Statement.RETURN_GENERATED_KEYS);
            String name = new String("ABCD");
            String address  = new String("333 Glory Lily");
            insertFirst.setString(1, name);
            insertFirst.setString(2, address);
            int result = insertFirst.executeUpdate();
            if (result != 0) {
               System.out.println("insert data to testdbsize");
            }
            ResultSet rs = insertFirst.getGeneratedKeys();

            while (rs.next()) {
            System.out.println("The generated key id is: " + rs.getInt(1));
            }

            rs.close();
            insertFirst.close();

            Also, does it matter if using column tag instead of "column name" 
tag?
            For example:
               <id name="id" column="ID">
                       <generator class="increment"/>
               </id>

Hope this help,
Lily



      
Mime
View raw message