ddlutils

Auto-incrementation with HSQLDB (2.2.8) + DDLUtils

我只是一个虾纸丫 提交于 2019-12-08 06:35:49
问题 I want to use HSQLDB as an embedded database but am having trouble getting it to auto-increment . As far as I understand, [CALL] IDENTITY() can be used to get the last primary key value. However, experiments through both iBatis and HSQLDB's DatabaseManagerSwing continually return a 0 value. How can I get auto-incrementation to work with HSQLDB? Edit: I didn't mention that I'm using DDLUtils to autogenerate tables. The following does not suit HSQLDB: <?xml version="1.0"?> <!DOCTYPE database

Auto-incrementation with HSQLDB (2.2.8) + DDLUtils

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 16:49:26
I want to use HSQLDB as an embedded database but am having trouble getting it to auto-increment . As far as I understand, [CALL] IDENTITY() can be used to get the last primary key value. However, experiments through both iBatis and HSQLDB's DatabaseManagerSwing continually return a 0 value. How can I get auto-incrementation to work with HSQLDB? Edit: I didn't mention that I'm using DDLUtils to autogenerate tables. The following does not suit HSQLDB: <?xml version="1.0"?> <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd"> <database name="testdb"> <table name="users"> <!--

Easiest way to obtain database metadata in Java?

被刻印的时光 ゝ 提交于 2019-11-27 02:21:07
问题 I'm familiar with the java.sql.DatabaseMetaData interface, but I find it quite clunky to use. For example, in order to find out the table names, you have to call getTables and loop through the returned ResultSet , using well-known literals as the column names. Is there an easier way to obtain database metadata? 回答1: It's easily done using DdlUtils: import javax.sql.DataSource; import org.apache.ddlutils.Platform; import org.apache.ddlutils.PlatformFactory; import org.apache.ddlutils.model