use of org.hibernate.exception.GenericJDBCException in project vsDiaryWriter by shilongdai.
the class DerbyEntryDatabase method createTable.
private void createTable() {
try {
Transaction tr = getSession().beginTransaction();
getSession().createSQLQuery("create table JOURNAL(Id INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1), Subject VARCHAR(2000), Date TIMESTAMP, Content CLOB(5242880))").executeUpdate();
tr.commit();
} catch (GenericJDBCException e) {
try {
throw e.getCause();
} catch (SQLException e1) {
if (e1.getSQLState().equals("X0Y32")) {
return;
}
throw new RuntimeException(e1);
} catch (Throwable e1) {
throw new RuntimeException(e1);
}
}
}
Aggregations