[ 
https://issues.apache.org/jira/browse/CAY-1040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ari Maniatis updated CAY-1040:
------------------------------

    Fix Version/s: Undefined future

> More control at creating AUTO_PK_SUPPORT table
> ----------------------------------------------
>
>                 Key: CAY-1040
>                 URL: https://issues.apache.org/jira/browse/CAY-1040
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>         Environment: 3.0M3
>            Reporter: Borut Bolcina
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>
> When running DbGenerator with:
>         generator.setShouldCreatePKSupport(true);
> it would be GREAT if one could control if the DELETE and INSERT statements 
> should be executed (maybe even automatically based on error at CREATE). The 
> method could be:
>         generator.setShouldCreatePKSupport(true, false);
> where second false would suppress the execution of DELETE FROM 
> AUTO_PK_SUPPORT and INSERT INTO AUTO_PK_SUPPORT if CREATE fails.
> What do you think?
> Sample output:
>  INFO [14:49:11.712] CREATE TABLE AUTO_PK_SUPPORT (  TABLE_NAME CHAR(100) NOT 
> NULL,  NEXT_ID BIGINT NOT NULL, UNIQUE (TABLE_NAME))
>  INFO [14:49:11.712] *** error.
> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'AUTO_PK_SUPPORT' 
> already exists
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
>         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
>         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
>         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
>         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
>         at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)
>         at 
> org.apache.cayenne.access.DbGenerator.safeExecute(DbGenerator.java:352)
>         at 
> org.apache.cayenne.access.DbGenerator.runGenerator(DbGenerator.java:330)
>         at 
> com.interseek.portal.server.Bootstrap.createTables(Bootstrap.java:155)
>         at com.interseek.portal.server.Bootstrap.<init>(Bootstrap.java:58)
>         at com.interseek.portal.server.Bootstrap.main(Bootstrap.java:71)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:271)
>         at java.lang.Thread.run(Thread.java:595)
>  INFO [14:49:11.712] DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN 
> ('table1', 'table2', 'table3')
>  INFO [14:49:11.728] INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES 
> ('table1', 200)
>  INFO [14:49:11.728] INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES 
> ('table2', 200)
>  INFO [14:49:11.728] INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES 
> ('table3', 200)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to