hibernate annotations / mx.data.IManaged

DTO2Fx
2009-04-16
2013-04-29
  • Hi,

    i'm trying to use the DTO2FX library to create my Actionscript classes, however
    when my Java Class is annotated with @Entity (hibernate) in addition to @FXClass, the generated
    actionscript class emplements the interface mx.data.IManaged, which is not
    available in flex sdk 3.

    Does anyone know a workaround for this behaviour ?

    thanks!

    -robert

     
    • Robert,

      As requested - i.e - workaround: if you download com.farata.components.blazeds project or equivalent clear_blazeds.swc and add it to your project you would have access to IManaged.

      This area is one of the focus ones for the next release. In particularly, we are adding FXDomainKey annotation for key values like SSN (can be more then one FXDomainKey), also - JPA compliant @Id annotation.

      Note that if you have variable and a getter, the getter takes over, so you should annotate the getter, not the variable.

      Kind Regards,
      Victor

       
    • Valery Silaev
      Valery Silaev
      2009-04-16

      This is by design: it's a default behavior to support LCDS with Hibernate 3.x (hence IManaged is generated for Entity classes)
      The workaround is trivial: make annotation explicit, i.e. define "kind" of AS3 class to generate like below

      /* DTO2FX import */
      import com.farata.dto2fx.annotations.FXClass;
      import com.farata.dto2fx.annotations.FXClassKind;
      /* JPA annotations import*/
      import javax.persistence.*

      @Entity
      @FXClass(kind=FXClassKind.REMOTE)
      public class MyEntity {
      ...
      }

       
      • Valery Silaev
        Valery Silaev
        2009-04-16

        Your question raises a question: why you should set "kind" explicitly for every JavaBean annotated with @Entity when we have project-wise parameter that defines "kind" of generated AS3 class (remote/managed)?

        So I've just commited a fix.

        Now, when you set explicitly APT parameter
        -Acom.faratasystems.dto2fx.default-class-kind=remote then this setting will take precedence over javax.persistence.Entity annotation. This means that classic "remote" AS3 class will be generated instead of IManaged implementation when @Entity is specified but @FXClass has no explicit "kind" definition.

         
    • thanks a lot !

       
    • George Cook
      George Cook
      2009-07-22

      can I second the thanks a lot. With the sourceforge rebrand I actually didn't see this forum, so I'm especially grateful for you pointing me here.

      Again, it's a great help to our worflow too -T H A N K S :)