Author: gbadner
Date: 2008-06-26 16:10:03 -0400 (Thu, 26 Jun 2008)
New Revision: 14815
Modified:
annotations/branches/v3_2_1_GA_CP/src/java/org/hibernate/cfg/AnnotationBinder.java
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/query/Chaos.java
Log:
JBPAPP-258 ANN-551, backporting 3.2.1.GA.patch01-brew into annotations 3_2_1_GA_CP branch
Modified:
annotations/branches/v3_2_1_GA_CP/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
---
annotations/branches/v3_2_1_GA_CP/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-06-26
16:09:18 UTC (rev 14814)
+++
annotations/branches/v3_2_1_GA_CP/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-06-26
20:10:03 UTC (rev 14815)
@@ -2,6 +2,8 @@
package org.hibernate.cfg;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@@ -943,6 +945,12 @@
log.debug( "Processing " + propertyHolder.getEntityName() + " " +
accessType + " annotation" );
List<XProperty> properties = annotatedClass.getDeclaredProperties( accessType );
+ //order so that property are used int he same order when binding native query
+ Collections.sort( properties, new Comparator<XProperty>() {
+ public int compare(XProperty property1, XProperty property2) {
+ return property1.getName().compareTo( property2.getName() );
+ }
+ } );
for ( XProperty p : properties ) {
if ( !p.isTypeResolved() && !discoverTypeWithoutReflection( p ) &&
!mustBeSkipped( p, mappings ) ) {
throw new AnnotationException(
Modified:
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/query/Chaos.java
===================================================================
---
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/query/Chaos.java 2008-06-26
16:09:18 UTC (rev 14814)
+++
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/query/Chaos.java 2008-06-26
20:10:03 UTC (rev 14815)
@@ -22,8 +22,8 @@
*/
@Entity
@Table(name="CHAOS")
-@SQLInsert( sql="INSERT INTO CHAOS(size, name, nickname, id)
VALUES(?,upper(?),?,?)")
-@SQLUpdate( sql="UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? WHERE id =
?")
+@SQLInsert( sql="INSERT INTO CHAOS(name, nickname, size, id)
VALUES(upper(?),?,?,?)")
+@SQLUpdate( sql="UPDATE CHAOS SET name = upper(?), nickname = ?, size = ? WHERE id =
?")
@SQLDelete( sql="DELETE CHAOS WHERE id = ?")
@SQLDeleteAll( sql="DELETE CHAOS")
@Loader(namedQuery = "chaos")
Show replies by date