facebook

GWT and Hibernate/Spring

  1. MyEclipse Archived
  2.  > 
  3. General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #269276 Reply

    DeanJones
    Member

    it has become painfully apparent that GWT and Hibernate don’t play well together. Hibernate mapped POJO’s are instrumented and will not compile/serialize to JavaScript. The only solution I have found is to create “mirror classes”, one for Hibernate, identical for GWT, and use this code http://gwt-spring-hibernate-reference.googlecode.com/svn/trunk/GWT_Spring_Hibernate_Sample/server_src/org/gwtspringhibernate/reference/rlogman/server/GeneralHelper.java

    to, via reflection, copy all properties. It takes care of one problem intrinsic to Hibernate, mapped Date columns aren’t really java.util.Date, but java.sql.Date, which also wont serialize. It does not handle collections, or things much needed like BigDecimal.

    A bit of tooling would really help here. Generate the mirror POJO’s, instead of reflection, generate Helpers to copy the properties, fix the Date types, provide options on copy of embedded collections, generate RemoteService stubs, add GWT Capabilities to a project, etc…

    I don’t need a visual designer, just some things to take out the repetitive grunt work.

    #269312 Reply

    Riyad Kalla
    Member

    I wonder if using JPA works any smoother? With the new JPA tooling in MyEclipse it’s almost too easy not to use it, but it does annotate the classes up (dunno if GWT has rules against annotations)

    #276592 Reply

    goldsounds
    Member

    As of v1.4, GWT’s java->javascript compiler doesn’t support Java5 syntax. That means no generics and no annotations (hence the typeArgs hack).

    In GWT 1.5 Java5 syntax will be supported. What this means for JPA and Hibernate Annotations is yet to be seen, but I can’t imagine that Google would put in Java5 syntax support without supporting the primary use of this feature, i.e. simple persistence.

    Speaking of which – does anyone else see embedding persistence specifics into code as being a potential portability nightmare? What about schema changes/upgrades? I haven’t tried to _maintain_ an app with annotation-based persistence yet. Anyone been bitten?

    D

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: GWT and Hibernate/Spring

You must be logged in to post in the forum log in