Here you can find the source of getSerialPrimaryKeyTypeString(Connection conn)
public static String getSerialPrimaryKeyTypeString(Connection conn) throws SQLException
//package com.java2s; /*/*from w w w.j ava2 s. c om*/ Weave (Web-based Analysis and Visualization Environment) Copyright (C) 2008-2011 University of Massachusetts Lowell This file is a part of Weave. Weave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, Version 3, as published by the Free Software Foundation. Weave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Weave. If not, see <http://www.gnu.org/licenses/>. */ import java.sql.Connection; import java.sql.SQLException; public class Main { public static String SQLSERVER = "Microsoft SQL Server"; public static String ORACLE = "Oracle"; public static String ORACLE_SERIAL_TYPE = "ORACLE_SERIAL_TYPE"; public static String getSerialPrimaryKeyTypeString(Connection conn) throws SQLException { String dbms = conn.getMetaData().getDatabaseProductName(); if (SQLSERVER.equalsIgnoreCase(dbms)) return "BIGINT PRIMARY KEY IDENTITY"; if (ORACLE.equalsIgnoreCase(dbms)) return ORACLE_SERIAL_TYPE; // for mysql and postgresql, return the following. return "SERIAL PRIMARY KEY"; } }