Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: auto-increment of primary key

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default auto-increment of primary key

    i created a database like this, create table createpincode(id MEDIUMINT NOT NULL AUTO_INCREMENT,serialno char(30) Not NULL, pincode char(30)NOT NULL, type char(30)NOT NULL,primary key(1d));
    public void createpins2(int pins, String type){
      String id=null;
    try{
       pinlocal=pinhome.create(new Integer(id),serialno,pins,type){
    catch(Exception ex){ex.getmessage();}
    it works fine without the auto-increment, but now i'm havin an error at the JBOSS
    The error is
    EjbException in method: public abstract void sessions.NewSessionLocalBusiness.create(int,java.l ang.String):
    javax.ejb.Exception:null
    at Sessions.NewSessionBean.Createpins2(NewsseeionBean .java:271)
    at sun.reflect.nativemethodAcessorImp.invoke(unknown source).


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: auto-increment of primary key

    I think you have an issue when you try to pass in a null String into the Integer() constructor.

    // Json

Similar Threads

  1. Auto Fill the TextField
    By malladiG in forum Java Theory & Questions
    Replies: 0
    Last Post: April 6th, 2010, 08:32 AM
  2. Auto contrast and auto brightness
    By oxxxis in forum Java Theory & Questions
    Replies: 0
    Last Post: January 21st, 2010, 03:00 PM