mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix PostgreSQL handling for null Serializable values (ALF-1614)
- Dialect determination sets a static that determines the setNull handling on Serializable - Default is (as before) Types.LONGVARBINARY but DB2 uses Types.BLOB git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19678 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,6 +32,7 @@ import java.sql.DriverManager;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
import java.sql.Types;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,6 +40,7 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.ibatis.SerializableTypeHandlerCallback;
|
||||||
import org.alfresco.repo.admin.patch.Patch;
|
import org.alfresco.repo.admin.patch.Patch;
|
||||||
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
||||||
import org.alfresco.repo.content.filestore.FileContentWriter;
|
import org.alfresco.repo.content.filestore.FileContentWriter;
|
||||||
@@ -138,7 +140,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
/**
|
/**
|
||||||
* @see PropertyValue#DEFAULT_MAX_STRING_LENGTH
|
* @see PropertyValue#DEFAULT_MAX_STRING_LENGTH
|
||||||
*/
|
*/
|
||||||
public static final void setMaxStringLength(int length)
|
private static final void setMaxStringLength(int length)
|
||||||
{
|
{
|
||||||
if (length < 1024)
|
if (length < 1024)
|
||||||
{
|
{
|
||||||
@@ -1171,6 +1173,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
int maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
int maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
||||||
|
int serializableType = SerializableTypeHandlerCallback.getSerializableType();
|
||||||
// Adjust the maximum allowable String length according to the dialect
|
// Adjust the maximum allowable String length according to the dialect
|
||||||
if (dialect instanceof AlfrescoSQLServerDialect)
|
if (dialect instanceof AlfrescoSQLServerDialect)
|
||||||
{
|
{
|
||||||
@@ -1189,6 +1192,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
// string_value varchar(1024),
|
// string_value varchar(1024),
|
||||||
// serializable_value varchar(8192) for bit data,
|
// serializable_value varchar(8192) for bit data,
|
||||||
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
||||||
|
serializableType = Types.BLOB;
|
||||||
}
|
}
|
||||||
else if (dialect instanceof HSQLDialect)
|
else if (dialect instanceof HSQLDialect)
|
||||||
{
|
{
|
||||||
@@ -1215,6 +1219,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
|
||||||
}
|
}
|
||||||
SchemaBootstrap.setMaxStringLength(maxStringLength);
|
SchemaBootstrap.setMaxStringLength(maxStringLength);
|
||||||
|
SerializableTypeHandlerCallback.setSerializableType(serializableType);
|
||||||
|
|
||||||
// Now override the maximum string length if it was set directly
|
// Now override the maximum string length if it was set directly
|
||||||
if (maximumStringLength > 0)
|
if (maximumStringLength > 0)
|
||||||
|
Reference in New Issue
Block a user