Kevin Menard reassigned CAY-1037:
---------------------------------
Assignee: Kevin Menard (was: Andrus Adamchik)
> DbGenerator destroys auto pk support
> ------------------------------------
>
> Key: CAY-1037
> URL: https://issues.apache.org/cayenne/browse/CAY-1037
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 3.0
> Reporter: Øyvind Harboe
> Assignee: Kevin Menard
> Priority: Critical
>
> The following code will destroy AUTO_PK_SUPPORT table.
> When I add a table, I need to add an entry to AUTO_PK_SUPPORT and since I had setShouldDropPKSupport(false) below, I thought
> that only new entries would be added.
> However, it seems that *all* entries are deleted from the auto_pk_suport table!
> There are some wicked new DbMerger capabilities in Cayenne that allows me to easily add fields and tables, but the auto_pk_support needs a similar update capability.
> A merger token for auto_pk_support?
> DbGenerator generator = new DbGenerator(adapter, destDataMap);
> generator.setShouldCreateFKConstraints(false);
> generator.setShouldCreatePKSupport(true);
> generator.setShouldCreateTables(false);
> generator.setShouldDropPKSupport(false);
> // we don't want to drop ALL tables, although it could have been useful to drop only the Mamut tables.
> generator.setShouldDropTables(false);
> try
> {
> generator.runGenerator(dataSource);
> } catch (Exception e)
> {
> throw new RuntimeException(e);
> }
> The last line in the log below killed my Friday evening ;-)
> 144906 [SocketListener0-8] INFO org.apache.cayenne.access.QueryLogger - CREATE TABLE AUTO_PK_SUPPORT ( TABLE_NAME CHAR(100) NOT NULL, NEXT_ID DECIMAL(19,0) NOT NULL, PRIMARY KEY(TABLE_NAME))
> 156875 [SocketListener0-8] INFO org.apache.cayenne.access.QueryLogger - *** error.
> java.sql.SQLException: There is already an object named 'AUTO_PK_SUPPORT' in the database.
> at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
> at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
> at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
> at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
> at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)
> at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:445)
> at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:623)
> at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1038)
> at org.apache.cayenne.access.DbGenerator.safeExecute(DbGenerator.java:352)
> at org.apache.cayenne.access.DbGenerator.runGenerator(DbGenerator.java:330)
> at com.zylin.payback.app.db.DBManager.addPkGen(DBManager.java:241)
> at com.zylin.payback.app.db.DBManager.addFields(DBManager.java:149)
> at com.zylin.payback.app.html.QPBBorder.createNewTables(QPBBorder.java:289)
> 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.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
> at org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)
> at org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
> at org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
> at org.apache.tapestry.link.DirectLink.trigger(DirectLink.java:119)
> at org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
> at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)
> at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
> at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
> at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
> at com.zylin.payback.app.tapestry.SequentialSessionFilter.doFilter(SequentialSessionFilter.java:27)
> at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
> at com.zylin.payback.app.auth.AuthFilter.doFilter(AuthFilter.java:48)
> at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
> at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
> at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> at org.mortbay.jetty.plus.PlusWebAppContext.handle(PlusWebAppContext.java:158)
> at org.mortbay.http.HttpServer.service(HttpServer.java:909)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
> at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> 166125 [SocketListener0-8] INFO org.apache.cayenne.access.QueryLogger - DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('CONTACT', 'CONTACT_CATEGORY', 'CONTACT_PERSON', 'COSTTYPE', 'CRITICALITY', 'Comment', 'Discussion', 'ELC_LOG', 'ELC_ROLE', 'ELC_ROLEMEMBER', 'ELC_STATUS', 'INCIDENT', 'Label', 'PROJECT', 'SERVICE', 'SERVICE_ACCESS', 'SYS_CLASS', 'SYS_ORGUNIT', 'SYS_USER', 'SysUserComment', 'TREATMENT', 'TREATMENT_LOG', 'TREAT_AREASPEC', 'TREAT_AREASPECCORRECTIVE', 'TREAT_AREASPECROOT', 'TREAT_CORRECTIVEACTIONS', 'TREAT_COST', 'TREAT_CUSTOMSPEC', 'TREAT_NOTIFICATION', 'consequence', 'frequency', 'groups', 'risk_color', 'severity', 'stored_queries', 'user_groups', 'users')
-- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
This archive was generated by hypermail 2.0.0 : Wed Aug 20 2008 - 20:16:08 EDT