Results 1 to 3 of 3
  1. #1
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Unhappy Setting Auto increment problem :(-:

    I have a problem with my java apllication that i am unable to create a enitity persistence class..

    The problem is that it does not takes the database table for entity class that doesn't have PRIMARY KEY..

    I found a way for it by applying PRIMARY KEY as AUTOINCREMENT column..

    But, since my application is to be work continuosly with database i cannot estimate a typical auto-increment value limit..

    Now what i want is to apply a composit primary key with "date" , "id" column as primary keys together, the "id" must be a AUTO-INCREMENT value that can reset itself from the begening whenever a day changes , i.e, id values resets itself after each day ??

    How can i achive this ??
    What i tried is like something as follows::

    Java Code:
    create table test (
    id int(4) zerofill auto_increment,
    mydate date,
    primary key (mydate,id)
    );
    
    insert into test (mydate) 
    values 
    ('2011-06-01'),
    ('2011-06-02'),
    ('2011-06-02'),
    ('2011-06-01'),
    ('2011-06-01'),
    ('2011-06-03');
    But it does not yeild me required result...Any suggestions please????

  2. #2
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Setting Auto increment problem :(-:

    Solved
    Last edited by ark; 12-11-2017 at 02:07 AM.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,144
    Rep Power
    12

    Default Re: Setting Auto increment problem :(-:

    Resurrecting old posts is not a good idea. A mod will probably close it. But even for a new post
    your reply is meaningless as you posted no help or solution.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. auto scrollbar Problem
    By prats_7189 in forum AWT / Swing
    Replies: 1
    Last Post: 02-11-2010, 02:38 PM
  2. Auto contrast and auto brightness
    By oxxxis in forum Java 2D
    Replies: 0
    Last Post: 01-21-2010, 09:32 PM
  3. Problem in setting Eclipse
    By Crisanto in forum New To Java
    Replies: 3
    Last Post: 10-29-2008, 07:48 PM
  4. Auto-complete/Auto-fix for custom statement
    By dark_cybernetics in forum Eclipse
    Replies: 0
    Last Post: 08-19-2008, 12:19 PM
  5. How to create auto-increment
    By Albert in forum JDBC
    Replies: 2
    Last Post: 07-04-2007, 06:23 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
  •