← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18110: minor introspector fix, properly handle TEXT types

 

------------------------------------------------------------
revno: 18110
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-23 11:34:37 +0700
message:
  minor introspector fix, properly handle TEXT types
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2015-01-19 09:33:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2015-01-23 04:34:37 +0000
@@ -40,6 +40,8 @@
 import org.hibernate.type.AssociationType;
 import org.hibernate.type.CollectionType;
 import org.hibernate.type.EntityType;
+import org.hibernate.type.SingleColumnType;
+import org.hibernate.type.TextType;
 import org.hibernate.type.Type;
 import org.hisp.dhis.common.AnalyticalObject;
 import org.hisp.dhis.common.BaseAnalyticalObject;
@@ -49,7 +51,6 @@
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.NameableObject;
-import org.hisp.dhis.user.UserGroup;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
@@ -182,13 +183,18 @@
                 AnyType anyType = (AnyType) type;
             }
 
-            if ( hibernateProperty.getColumnSpan() > 0 )
+            if ( SingleColumnType.class.isInstance( type ) )
             {
                 Column column = (Column) hibernateProperty.getColumnIterator().next();
 
                 property.setUnique( column.isUnique() );
                 property.setRequired( !column.isNullable() );
                 property.setLength( column.getLength() );
+
+                if ( TextType.class.isInstance( type ) )
+                {
+                    property.setLength( Integer.MAX_VALUE );
+                }
             }
 
             properties.put( property.getName(), property );