diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/content-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/content-common-SqlMap.xml
index 0393da16d4..9333e4dac6 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/content-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/content-common-SqlMap.xml
@@ -221,7 +221,7 @@
where
id = #id# and
orphan_time is null
- orphan_time = oldOrphanTime
+ orphan_time = #oldOrphanTime#
diff --git a/source/java/org/alfresco/repo/domain/contentdata/ContentDataDAOTest.java b/source/java/org/alfresco/repo/domain/contentdata/ContentDataDAOTest.java
index bfe72c7391..7a8d19b8bb 100644
--- a/source/java/org/alfresco/repo/domain/contentdata/ContentDataDAOTest.java
+++ b/source/java/org/alfresco/repo/domain/contentdata/ContentDataDAOTest.java
@@ -224,6 +224,19 @@ public class ContentDataDAOTest extends TestCase
}
}
+ /**
+ * Check that orphaned content can be re-instated.
+ */
+ public void testReinstate_ALF3867()
+ {
+ ContentData contentData = getContentData();
+ Pair resultPair = create(contentData);
+ getAndCheck(resultPair.getFirst(), contentData);
+ delete(resultPair.getFirst());
+ // Now create a ContentData with the same URL
+ create(contentData);
+ }
+
public void testContentUrl_FetchingOrphansNoLimit() throws Exception
{
ContentData contentData = getContentData();