Search code examples
springhibernategwtsmartgwt

SmartGWT Stack Overflows on JSTranslate


So I have been trying to get SmartGWT to work with the automatic data source connection to a spring configured hibernate bean and plug that into the advanced filter builder widget.

I can see in the log that it works halfway in that it builds the data source lookup stuff correctly and maps the model class automatically as it should. It also makes a correct hibernated SQL query to pull back data from the database, but when it sends the json result to the client, the JSTranslator stack overflows on the translate method. It's like it it recursing indefinitely for some reason. It smells like a smartgwt bug to me, but I'm not sure. The reason I think it smells like a bug is that when I delete all data from the table it doesn't error and returns the column list to the client correctly. Very frustrating! The ds.xml file looks something like this:

<DataSource
    ID="humintHB"
    serverType="hibernate"
    autoDeriveSchema="true"
    schemaBean="com.fgm.csip.model.pub.Humint"
    beanClassName="com.fgm.csip.model.pub.Humint">
<serverObject lookupStyle="spring" bean="humintDao"/>

<operationBindings>
        <binding operationType="fetch" serverMethod="fetch">
        <serverObject  lookupStyle="spring" bean="humintDao"/>
        </binding>
    </operationBindings>
</DataSource>

Solution

  • Ok, so I tested by commenting out all the member field types one by one and got it working.

    The culprit member field is the following:

    @Column(name = "geog")
    @Type(type = "org.hibernatespatial.GeometryUserType")
    public Geometry getGeog() {
        return geog;
    }
    

    Where geog is a com.vividsolutions.jts.geom.Geometry instance. When commenting out the getter, everything else works as expected. When the getter is left in, it barfs with an infinite recursion in JSTranslator.