KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > db > DBUtils


1 package sellwin.db;
2
3 import sellwin.domain.*;
4 import java.util.*;
5
6 // SellWin http://sourceforge.net/projects/sellwincrm
7
//Contact support@open-app.com for commercial help with SellWin
8
//This software is provided "AS IS", without a warranty of any kind.
9

10
11 /**
12  * a utility class for the database layer
13  */

14 public class DBUtils {
15
16     /**
17      * generate a primary key value
18      * the sleep() guarantees that no two requests get
19      * the same milli value returned by the date routine
20      *
21      * @return a primary key value
22      */

23     public static final synchronized long generatePK() {
24         try {
25             Thread.currentThread().sleep(5);
26         } catch (InterruptedException JavaDoc e) {
27             e.printStackTrace();
28         }
29         Date d = new Date();
30         return d.getTime();
31     }
32 }
33
Popular Tags