[ http://mc4j.org/jira/browse/STS-247?page=comments#action_10435 ] 
            
Simon commented on STS-247:
---------------------------

(continued from above)

example stack trace: 

> The stack trace:
>
> net.sourceforge.stripes.exception.StripesRuntimeException: Could not
> build JavaScript for object. An exception was thrown while trying to
> convert a property from Java to JavaScript. The object being converted
> is: com.kembuco.autotracker.model.Automobile <at> b36ee3db
>         at 
> net.sourceforge.stripes.ajax.JavaScriptBuilder.build(JavaScriptBuilder.java:154)
>         at 
> net.sourceforge.stripes.ajax.JavaScriptResolution.execute(JavaScriptResolution.java:50)
>         at 
> net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:168)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

The problem here is that rather than exporting the actual object the loaded 
object is enhanced by Hibernate with a variety of internal attributes that 
don't export properly for various reasons.

Rather than suggesting that we specifically make Stripes work with Hibernate, 
I'd suggest that a simple generic interface be supported to allow the caller to 
suppy an arbitrary algorithm for excluding properties.

I have attached a patch which illustrates an implementation of this which 
allows Hibernate objects to export correctly simply by ignoring the internal 
hibernate properties by excluding them by name.

Using this patch, Hibernate objects can be passed to JavaScriptBuilder 
successfully with a construct like:

      return new JavaScriptResolution(hibnerateObject, new ExcludeByName(new 
String[] {
          "callback",
          "callbacks",
          "hibernateLazyInitializer"      
      }));  

Hope this is helpful.  I think it's important for Stripes to be able to send 
back Hibernate objects as Javascript.

(see separately attached patch file)

> JavaScriptBuilder does not work with Objects loaded by Hibernate
> ----------------------------------------------------------------
>
>                 Key: STS-247
>                 URL: http://mc4j.org/jira/browse/STS-247
>             Project: Stripes
>          Issue Type: Bug
>    Affects Versions: Release 1.4, Release 1.3.2
>         Environment: Win32/JDK1.5
>            Reporter: Simon
>         Assigned To: Tim Fennell
>
> If an object is loaded via Hibernate and then passed to the 
> JavaScriptBuilder, it throws various exceptions.
> See http://article.gmane.org/gmane.comp.java.stripes.user/769/ for a report 
> of the error - to summarize:

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to