<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SchemaCreation considering TablePrefix in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109187#M76624</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The way to handle existing ddl can be implemented without redundancy. Why not simply add placeholders into the scripts before each table name and then replace these placeholders with schema and tableprefix upon DDL execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A placeholder could be &lt;/SPAN&gt;&lt;STRONG&gt;{ACT_PREFIX}&lt;/STRONG&gt;&lt;SPAN&gt;, so the DDL would look similar to this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;create table {ACT_PREFIX}ACT_GE_PROPERTY (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NAME_ varchar(64) not null,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUE_ varchar(300),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REV_ integer,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; primary key (NAME_)&lt;BR /&gt;);&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Any line where a table name is mentioned would contain the placeholder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Replacement implementation would fit quiet well into DbSqlSession.addSqlStatementPiece() where each line is handled. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As there are 2 properties available on the configuration, there would be 3 cases for the replacement: &lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;Schema = null, TablePrefix = null &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = ""&lt;/STRONG&gt;&lt;/UL&gt;&lt;UL&gt;Schema = "MYSCHEMA", TablePrefix = null &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = "MYSCHEMA."&lt;/STRONG&gt; &amp;lt;&amp;lt; watch the '.' at the end&lt;/UL&gt;&lt;UL&gt;Schema = null, TablePrefix = "MYTABLEPREFIX" &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = "MYTABLEPREFIX"&lt;/STRONG&gt;&lt;/UL&gt;&lt;SPAN&gt;Any more concerns&amp;nbsp; &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The remark about DbAdmins is of course one side of the customer world, others like it well integrated into the application server, or they prefer admin cockpits within a larger bpm platform solution. Especially looking at cloud solutions the latter might be expected from a bpm solution.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Nov 2012 20:52:42 GMT</pubDate>
    <dc:creator>catandgrep</dc:creator>
    <dc:date>2012-11-15T20:52:42Z</dc:date>
    <item>
      <title>SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109185#M76622</link>
      <description>Hi folks,is there a need for extending DbSchema creation routines to take care of the table prefix and database schema? The current release does not allow schema creation with prefixes by the activiti engine. Instead admins need to manually create/update all the tables.It would be quiet handy, to st</description>
      <pubDate>Wed, 14 Nov 2012 22:02:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109185#M76622</guid>
      <dc:creator>catandgrep</dc:creator>
      <dc:date>2012-11-14T22:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109186#M76623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The reason why we didn't do it, is because we see that in most companies the creation of the database is not allowed by applications itself. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In many companies, this is the job of the DBA, who will inspect the DDL's and tweak where needed. As such, that is why we don't prioritize it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, this would not be an easy fix, because we would need to find a way to keep the DDL files the way they are now, while also providing a way to add the prefix. For the runtime tables it is easier, as we can simply do it in the MyBatis mappings. Do you have an idea how you'd tackle it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 18:28:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109186#M76623</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-11-15T18:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109187#M76624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The way to handle existing ddl can be implemented without redundancy. Why not simply add placeholders into the scripts before each table name and then replace these placeholders with schema and tableprefix upon DDL execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A placeholder could be &lt;/SPAN&gt;&lt;STRONG&gt;{ACT_PREFIX}&lt;/STRONG&gt;&lt;SPAN&gt;, so the DDL would look similar to this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;create table {ACT_PREFIX}ACT_GE_PROPERTY (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NAME_ varchar(64) not null,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUE_ varchar(300),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REV_ integer,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; primary key (NAME_)&lt;BR /&gt;);&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Any line where a table name is mentioned would contain the placeholder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Replacement implementation would fit quiet well into DbSqlSession.addSqlStatementPiece() where each line is handled. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As there are 2 properties available on the configuration, there would be 3 cases for the replacement: &lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;Schema = null, TablePrefix = null &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = ""&lt;/STRONG&gt;&lt;/UL&gt;&lt;UL&gt;Schema = "MYSCHEMA", TablePrefix = null &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = "MYSCHEMA."&lt;/STRONG&gt; &amp;lt;&amp;lt; watch the '.' at the end&lt;/UL&gt;&lt;UL&gt;Schema = null, TablePrefix = "MYTABLEPREFIX" &amp;gt;&amp;gt; &lt;STRONG&gt;ACT_PREFIX = "MYTABLEPREFIX"&lt;/STRONG&gt;&lt;/UL&gt;&lt;SPAN&gt;Any more concerns&amp;nbsp; &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The remark about DbAdmins is of course one side of the customer world, others like it well integrated into the application server, or they prefer admin cockpits within a larger bpm platform solution. Especially looking at cloud solutions the latter might be expected from a bpm solution.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 20:52:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109187#M76624</guid>
      <dc:creator>catandgrep</dc:creator>
      <dc:date>2012-11-15T20:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109188#M76625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Any more concerns&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Sure, I've thought of that approach (it is the same as the one for the MyBatis mapping files). But then you can't just take the files and execute them directly, as you'd always need to go through a 'search and replace' phase. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The remark about DbAdmins is of course one side of the customer world, others like it well integrated into the application server, or they prefer admin cockpits within a larger bpm platform solution. Especially looking at cloud solutions the latter might be expected from a bpm solution.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course. But in our experience, Activiti is typically used in enterprise environments with dba's.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I do agree that in development mode it should be easier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That being said, what is wrong with doing (eg on Oracle)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;ALTER SESSION SET CURRENT_SCHEMA = &amp;lt;schema name&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;And then execute all the DDL's?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll ping the other core developers and see what their opinion is.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 18:08:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109188#M76625</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-11-16T18:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109189#M76626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am with Joram on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also have a look at the following unit test:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;org.activiti.engine.test.db.DatabaseTablePrefixTest&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 08:35:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109189#M76626</guid>
      <dc:creator>meyerd</dc:creator>
      <dc:date>2012-11-19T08:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109190#M76627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just as an information: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's not all enterprise environments, that handle DB actions that strict up to production, so that only db admins are allowed to create and update schemas in production. SAP Java Servers for example have their own packaging type for DB Schema deployment, and it's always a developer task to create such deployment artifacts. (As always) SAP has introduced an additional abstraction layer (called Java Dictionary) to ensure consistency across db vendors and to block incompatible schema updates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However from activity point fo view, I see two kinds of 'table prefix'-situations, and please correct me if I get them wrong:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Schema creation within isolated DB SCHEMAs. That's what you mean by executing ALTER SESSION SET CURRENT_SCHEMA = &amp;lt;schema name&amp;gt; or within org.activiti.engine.test.db.DatabaseTablePrefixTest.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Schema creation within the same DB SCHEMA but with different table name prefixes. So the table names have an additional prefix that do NOT necessarily specify the schema.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Especially the last one would not work with ALTER SESSION statement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both scenarios are supported by activiti-runtime components, but not yet by the 'schema-handling'-part. Isn't that a gap that needs to be filled?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see your point, that executing the plain sql files won't be possible when we have placeholders in there. But wouldn't it be another idea, to do it the other way around then: So when invoking the schema creation methods, they take care of adding the prefix during execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you think?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 10:40:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109190#M76627</guid>
      <dc:creator>catandgrep</dc:creator>
      <dc:date>2012-11-19T10:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109191#M76628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I see your point, that executing the plain sql files won't be possible when we have placeholders in there. But wouldn't it be another idea, to do it the other way around then: So when invoking the schema creation methods, they take care of adding the prefix during execution.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Sure, I understand that suggestion. But my point still remains: then we make it easier for developers (and only those with specific environments) and make it harder for DBA's. I would be fine with a solution that doesn't interfere with the plain sql DDL files for a dba. Or do you see a suggestion that is smart enough to inject those prefixes when invoking the schema?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only solution which could work is if we centralise all our database schema in something like Liquibase (&lt;/SPAN&gt;&lt;A href="http://www.liquibase.org/" rel="nofollow noopener noreferrer"&gt;http://www.liquibase.org/&lt;/A&gt;&lt;SPAN&gt;). That way, we can generate the DDL's for the dba's and also generate other files to be used at runtime. But such a thing would be a very costly thing to do, time-wise and is currently not on our priority list …&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 20:18:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109191#M76628</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-11-19T20:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109192#M76629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Or do you see a suggestion that is smart enough to inject those prefixes when invoking the schema?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Yup - why not keep it simple instead of using something like Liquibase:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's assume the names of all activiti tables is a constant string array. During script execution each line of the current DDL script can be parsed and checked, if any table name is part of the line. If so AND if an prefix/schema is defined, the necessary piece will be injected: Either with a simple string operation, or by using a regular expression - which I prefer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This piece of code can be placed in org.activiti.engine.impl.db.DbSqlSession and more specifically in method addSqlStatementPiece(String sqlStatement, String line), or a new method that is called from within addSqlStatementPiece.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 22:01:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109192#M76629</guid>
      <dc:creator>catandgrep</dc:creator>
      <dc:date>2012-11-19T22:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109193#M76630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There have been recent commits regarding schema creation/update refactoring with liquibase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you also considering custom tableprefix / schema handling within that refactoring? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TablePrefix/schema is already available on the engineConfiguration, but I don't see them to come into play so far for schema creation/update.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2013 08:07:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109193#M76630</guid>
      <dc:creator>catandgrep</dc:creator>
      <dc:date>2013-02-07T08:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109194#M76631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think schema creation and table prefixes are two different concern. Schema creation should be handled by DBA however table creation can be done in application level (to make the job easier in development, perhaps ).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I found a way to create tables with prefixes and keep the DDL files the way they are now. all activiti tables already have a prefix "ACT_" so replacing the prefix can do the job.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/Activiti/Activiti/pull/172" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/pull/172&lt;/A&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Nov 2013 00:19:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109194#M76631</guid>
      <dc:creator>mortezaadi</dc:creator>
      <dc:date>2013-11-10T00:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109195#M76632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I understand the idea of keeping the ".sql" scripts free of placeholders for raw usage in database, but the current situation is a bit embarassing in 5.15.1: you change the schema or databaseTablePrefix in a configuration with automatic table creation and get ugly exceptions about "Table &amp;lt;yourPrefix&amp;gt;XXX not found" because the table was created without the &amp;lt;yourPrefix&amp;gt; prefix. This makes you think that Activiti has some issues. I had to use the debugger to see how the table creation is done and look on the forum to find this post after several keyword search on Google and on the forum. I don't think most people evaluating Activiti will do that…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not have a kind of automatic placeholder for table creation in the &lt;/SPAN&gt;&lt;A href="http://svn.codehaus.org/activiti/activiti/trunk/modules/activiti-engine/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java" rel="nofollow noopener noreferrer"&gt;DbSqlSession#executeSchemaResource&lt;/A&gt;&lt;SPAN&gt; instead of having them in the ".sql" file ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The `sqlStatement` variable could be modified as such:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;String prefix = … // determined from dbSqlSessionFactory.getDatabaseTablePrefix() and dbSqlSessionFactory.getDatabaseSchema ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sqlStatement = sqlStatement.replaceFirst("create table (?!"+prefix+")", "create table "+prefix); // if there is no prefix, we add it&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The alternative would be to raise an error when a configuration mismatch is present e.g. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (isAutomaticSchemaCreationOrUpdateSpecified &amp;amp;&amp;amp; isSchemaOrDatabaseTablePrefixSpecified) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new IllegalArgumentException("automatic schema creation/update is not allowed with custom schema or databaseTablePrefix");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 07:37:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109195#M76632</guid>
      <dc:creator>jkronegg</dc:creator>
      <dc:date>2014-04-23T07:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109196#M76633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The replacing approach should be done with a lot of constructs (alter table, add index, …) and is error-prone IMHO. Having a warning/error might make sense, although the javadocs on ProcessEngineConfiguration are rather clear on the behaviour:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt; /**&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * Allows configuring a database table prefix which is used for all runtime operations of the process engine.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * For example, if you specify a prefix named 'PRE1.', activiti will query for executions in a table named&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * 'PRE1.ACT_RU_EXECUTION_'. &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * &amp;lt;p /&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * &amp;lt;strong&amp;gt;NOTE: the prefix is not respected by automatic database schema management. If you use &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * {@link ProcessEngineConfiguration#DB_SCHEMA_UPDATE_CREATE_DROP} &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * or {@link ProcessEngineConfiguration#DB_SCHEMA_UPDATE_TRUE}, activiti will create the database tables &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * using the default names, regardless of the prefix configured here.&amp;lt;/strong&amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * @since 5.9&lt;BR /&gt;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; protected String databaseTablePrefix = "";&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; /**&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * In some situations you want to set the schema to use for table checks / generation if the database metadata&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * doesn't return that correctly, see &lt;A href="https://jira.codehaus.org/browse/ACT-1220" rel="nofollow noopener noreferrer"&gt;https://jira.codehaus.org/browse/ACT-1220&lt;/A&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * &lt;A href="https://jira.codehaus.org/browse/ACT-1062" rel="nofollow noopener noreferrer"&gt;https://jira.codehaus.org/browse/ACT-1062&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; protected String databaseSchema = null;&lt;BR /&gt;&lt;/CODE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 07:46:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109196#M76633</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2014-04-24T07:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109197#M76634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're right, I hadn't thought about all the SQL constructs and the javadoc describes the issue. However, the javadoc is on the field and is not displayed when when you look at the getter/setter in an IDE such as Eclipse and only a few people will read the code before using the product.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm in favor of raising an exception because this would clearly notify the developper that some misconfiguration occured (the warning may not be seen). And this would prevent to polluate the database with table without prefixes when the developper wants tables with prefix.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But you could even make it friendlier to the community by adding a &amp;lt;code&amp;gt;protected String transformSqlStatement(String sqlStatement) { return sqlStatement; }&amp;lt;/code&amp;gt; which is called on the "sqlStatement" just before executing it, and provide a way to make the DbSqlSession pluggable so that developpers can use their own implementation with an overrided "transformSqlStatement" method. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Julien&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 20:28:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109197#M76634</guid>
      <dc:creator>jkronegg</dc:creator>
      <dc:date>2014-04-24T20:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109198#M76635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Julien, makes sense. Any chance you're willing to contribute this fix to activiti, since you're deep into it already &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Source-jar's and javadoc-jars should be in maven central (since 5.14), so if you're using maven in your IDE, it should download the sources and show javadoc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 08:16:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109198#M76635</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2014-04-25T08:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: SchemaCreation considering TablePrefix</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109199#M76636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Having studied the table generation deeper, I don't think its possible to have both the exception check and the "transformSqlStatement" if a "transformation plugin" is present because we will not be aware of the plugin behavior (would it implement the prefix stuff or only format the query for pretty printing when logged?).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Moreover, the behavior is really difficult to predict since the developper may want to change the configuration from one version to the other. For example if he first uses databaseTablePrefix=A then for an update a databaseTablePrefix=B (both with schemaUpdate=true), the script should drop A*, then create B*. So the "transformSqlRequest plugin" would need to know both prefixes to build the tables. Definitely a difficult task…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up with the following patch:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;— C:/partage/Softs/Java/Librairies/Activiti/activiti-5.15.1/libs/activiti-engine-5.15.1-sources/org/activiti/engine/impl/db/DbSqlSession.java Fri May 09 00:15:00 2014&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+++ C:/Dev/workspace/activiti-src/activiti-engine-5.15.1-sources/org/activiti/engine/impl/db/DbSqlSession.java Fri May 09 00:03:13 2014&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@@ -32,6 +32,7 @@&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import java.util.regex.Pattern;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import org.activiti.engine.ActivitiException;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+import org.activiti.engine.ActivitiIllegalArgumentException;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import org.activiti.engine.ActivitiOptimisticLockingException;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import org.activiti.engine.ActivitiWrongDbException;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import org.activiti.engine.ProcessEngine;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@@ -1124,6 +1125,12 @@&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; public void performSchemaOperationsProcessEngineBuild() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; String databaseTablePrefix = Context.getProcessEngineConfiguration().getDatabaseTablePrefix();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+ if (!org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.equals(databaseSchemaUpdate) &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp; databaseTablePrefix!=null &amp;amp;&amp;amp; !databaseTablePrefix.isEmpty()) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // update/update_create_drop/drop_create not compatible with prefix =&amp;gt; raise error&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp; throw new ActivitiIllegalArgumentException("databaseTablePrefix is not supported when using databaseSchemaUpdate, see &lt;/SPAN&gt;&lt;A href="http://forums.activiti.org/content/schemacreation-considering-tableprefix" rel="nofollow noopener noreferrer"&gt;http://forums.activiti.org/content/schemacreation-considering-tableprefix&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbSchemaDrop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It probably miss the trick between the databaseSchema and the databaseTablePrefix.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2014 22:14:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/schemacreation-considering-tableprefix/m-p/109199#M76636</guid>
      <dc:creator>jkronegg</dc:creator>
      <dc:date>2014-05-08T22:14:58Z</dc:date>
    </item>
  </channel>
</rss>

