Menu

if the generated code look like these ..

King Chau
2005-07-30
2013-04-25
  • King Chau

    King Chau - 2005-07-30

    sql2java is good now

    but if the generated code look like Firestorm/DAO does, it will be great!

    http://www.codefutures.com/products/firestorm/faq/jdbc/transactions.html

     
    • nr

      nr - 2005-07-30

      Hello,

      Take a look at our example program that uses our generated code:
      http://sql2java.sourceforge.net/xref/sql2java/sample/SampleMain.html

      The way we handle transaction seems simpler than what you suggest. Please explain how we could
      improve it.

      Thanks for your feedback

      Nicolas.

       
    • King Chau

      King Chau - 2005-08-01

      Hi Nicolas,

      I compared several java code generators, such as sql2java, torque, mdaog.sf.net, firestorm @ www.codefutures.com.

      I found some approaches are good:

      1. separate the generated code and editable file.
      In this way, if there is any change on the schema, my override codes are in another file. Don't need to merge the code, but override the file.

      2. Composite Primary key can be handled:
      Currently sql2java can handle single field primary key?

      sample code from Firstorm/DAO (not open source)
      CustomerDao dao = CustomerDaoFactory.create();
      Customer customer = new Customer();
      customer.setId( null );
      customer.setName( "Andy" );
      CustomerPk pk = dao.insert( customer);

      3. output structure/pattern is easy to understand.
      DAO
      DTO
      Exception
      Factory
      ...

      Just for reference.
      You are doing very well too.

       
    • King Chau

      King Chau - 2005-08-01

      public interface CustomerDAO
      {
        public void insert(Customer customer)
         throws CustomerDAOException;

        public void update(CustomerPK pk, Customer customer)
         throws CustomerDAOException;

        public void delete(CustomerPK pk)
         throws CustomerDAOException;

        public Customer[] findAll()
         throws CustomerDAOException;

        public Customer findByPrimaryKey(String email)
         throws CustomerDAOException;

        public Customer[] findByCompany(int companyId)
         throws CustomerDAOException;
      }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.