Results 1 to 3 of 3
  1. #1
    valentine is offline Member
    Join Date
    May 2010
    Posts
    1
    Rep Power
    0

    Thumbs up primarykey autho-increment

    pls, i'm having problem with ejb create method that has to create an auto increment in mysql database table.
    DATABASE TABLE: create table createpincode(id MEDIUMINT NOT NULL AUTO_INCREMENT,seriano char(30) NOT NULL, pincode char(30) NOT NULL,type char(30) NOT NULL, PRIMARY KEY(id));
    e.g public void createpins(int pins, String type){
    String id=null;
    try{
    pinlocal=pinhome.create(new Integer(id),serialno,pins,type);
    }catch(Exception ex){}
    }
    the error at the jboss is
    Exception in method: public abstract void sessions.NewsessionLocalBusiness.create(int, java.lang.String):
    javax.ejb.Exception:null at session.NewsessionBean.createpins2(NewsessionBean. java:271) at sun.reflect.NativemethodAccessorImpl.invoke(unknow n source). what should i do becouse it works fine without the auto_increment primary key.
    Last edited by valentine; 05-13-2010 at 05:49 PM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    1.) Don't do catch(Exception ex){} at least print the stack trace of the exception. You are hiding exceptions so no one knows if there is a problem.
    2.)Post the exception that you get. What is being reported as being null?

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default

    Well, this:
    new Integer(id)

    Will throw a NumberFormatException since id is always null.

Similar Threads

  1. War file generation
    By rummy in forum New To Java
    Replies: 1
    Last Post: 02-08-2010, 12:57 PM
  2. Report generation
    By anilkumar_vist in forum Advanced Java
    Replies: 1
    Last Post: 12-14-2009, 12:26 PM
  3. War file generation
    By vislawath.jawaharlal in forum Threads and Synchronization
    Replies: 0
    Last Post: 04-07-2009, 01:12 PM
  4. random generation
    By carlos123 in forum New To Java
    Replies: 10
    Last Post: 01-09-2008, 03:43 AM
  5. String generation
    By codingisfun22 in forum Advanced Java
    Replies: 3
    Last Post: 12-03-2007, 05:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •