From 0e20d34cd8da3c0ed6b7904074620d2fd24913e5 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Thu, 12 May 2011 15:42:26 +0800 Subject: [PATCH] HHH-6133 add an additional AnnotationValue for each mocked AnnotationInstance to mark it is from xml --- .../source/annotations/xml/mocker/MockHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/xml/mocker/MockHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/xml/mocker/MockHelper.java index 2d79a3047e..14a4b5e439 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/xml/mocker/MockHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/xml/mocker/MockHelper.java @@ -311,7 +311,14 @@ public class MockHelper { if ( values == null || values.length == 0 ) { values = EMPTY_ANNOTATION_VALUE_ARRAY; } - return AnnotationInstance.create( name, target, values ); + return AnnotationInstance.create( name, target, addMockMark( values ) ); + } + + private static AnnotationValue[] addMockMark(AnnotationValue[] values) { + AnnotationValue[] newValues = new AnnotationValue[values.length + 1]; + System.arraycopy( values, 0, newValues, 0, values.length ); + newValues[values.length] = booleanValue( "isMocked", true ); + return newValues; }