mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
MOB-448: Better patch for JDBC3 generated keys
- Fixes bug with different column types not matching generated key target type - Submitted to https://issues.apache.org/jira/browse/IBATIS-142 - MySQL and SQLServer use generated keys - Other tidy ups git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13732 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,7 +35,7 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class ActivityFeedDAO
|
||||
{
|
||||
private long id; // internal DB-generated id
|
||||
private Long id; // internal DB-generated id
|
||||
private String activityType;
|
||||
private String activitySummary;
|
||||
private String activitySummaryFormat;
|
||||
@@ -48,12 +48,12 @@ public class ActivityFeedDAO
|
||||
private long postId; // for debug - not an explicit FK constraint, could be used to implement re-generate
|
||||
|
||||
|
||||
public long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id)
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ import org.alfresco.service.cmr.activities.FeedControl;
|
||||
*/
|
||||
public class FeedControlDAO
|
||||
{
|
||||
private long id; // internal DB-generated id
|
||||
private Long id; // internal DB-generated id
|
||||
private String feedUserId;
|
||||
private String siteNetwork;
|
||||
private String appTool;
|
||||
@@ -66,12 +66,12 @@ public class FeedControlDAO
|
||||
return new FeedControl(this.siteNetwork, this.appTool);
|
||||
}
|
||||
|
||||
public long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id)
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ public class ActivityPostDAO
|
||||
{
|
||||
public enum STATUS { POSTED, PENDING, PROCESSED, ERROR };
|
||||
|
||||
private long id; // internal DB-generated sequence id
|
||||
private Long id; // internal DB-generated sequence id
|
||||
private String activityData;
|
||||
private String activityType;
|
||||
private String userId;
|
||||
@@ -48,11 +48,11 @@ public class ActivityPostDAO
|
||||
private long minId = -1;
|
||||
private long maxId = -1;
|
||||
|
||||
public long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setId(long id)
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
@@ -1,47 +0,0 @@
|
||||
package org.alfresco.repo.domain.ibatis;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.alfresco.ibatis.HierarchicalSqlMapClientFactoryBean;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
/**
|
||||
* Extension to the SQLMap factory to produce <tt>SqlMapClient</tt> instances that
|
||||
* cater for Alfresco extensions.
|
||||
* <p>
|
||||
* Currently, this is just a hack to find the Hibernate dialect and provide that as
|
||||
* a property to the factory code. This will go away if we move over to iBatis; to be
|
||||
* replaced with something similar to the schema script loading that uses a hierarchy
|
||||
* of databases.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.1
|
||||
*/
|
||||
public class AlfrescoSqlMapClientFactoryBean extends HierarchicalSqlMapClientFactoryBean
|
||||
{
|
||||
|
||||
@Override
|
||||
protected SqlMapClient buildSqlMapClient(Resource configLocation, Properties properties) throws IOException
|
||||
{
|
||||
// Get the Hibernate dialect from the system properties
|
||||
String hibernateDialect = System.getProperty(Environment.DIALECT);
|
||||
if (hibernateDialect == null)
|
||||
{
|
||||
return super.buildSqlMapClient(configLocation, properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new Properties();
|
||||
}
|
||||
properties.put("hibernate.dialect", hibernateDialect);
|
||||
return super.buildSqlMapClient(configLocation, properties);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user