0 Replies Latest reply on Nov 9, 2006 10:24 AM by mrbahr

    Custom Hibernate Assembler and SpringFramework

    mrbahr
      Hi -

      I have the need to inject the HibernateAssembler with an already created sessionFactory, which I have done. When the HibernateAssembler is created, I use a custom HibernateHelper to get the Spring context and get the sessionFactory bean. I have one withoug the flex session context and another one with the flex session context handler:

      hibernateConfig.setProperty("hibernate.current_session_context_class", "flex.data.adapters.FlexHibernateSessionContext");

      The fill works correctly. It calls the adapter and returns to the client correctly. However, if I change anything on the client, I get the following exception on the server (I assume it is synching):

      [Flex][WARN] Ignoring set property uid for type com.presidio.organization.Organization as a setter could not be found.
      [Flex][WARN] Ignoring set property uid for type com.presidio.organization.Organization as a setter could not be found.
      [Flex][ERROR] Exception when invoking service: data-service1
      with message: Flex Message (flex.data.messages.DataMessage)
      operation = transacted
      id = null
      clientId = 24BB268B-BD0B-55FA-B812-A4A640605B9A
      correlationId =
      destination = organization
      messageId = F2415AC4-E1E2-C52C-5E36-CDEB2B903066
      timestamp = 1163095911437
      timeToLive = 0
      body =
      [
      Flex Message (flex.data.messages.DataMessage)
      operation = update
      id = ASObject(3273208){organizationId=10}
      clientId = 581BC236-2220-BCD4-5487-CDE9ECC62A13
      correlationId = F2415AC4-E1E2-C52C-5E36-CDEB2B903066
      destination = organization
      messageId = CEA6DCA3-EFC4-1667-C34B-CDEB2B903976
      timestamp = 0
      timeToLive = 0
      body =
      [

      [
      name
      ],
      com.presidio.organization.Organization@527179,
      com.presidio.organization.Organization@97cd75
      ]
      ]
      hdr(DSEndpoint) = my-secure-http
      exception: flex.data.DataServiceException: Unable to access UserTransaction in DataService.

      [Flex][ERROR] Error handling message: flex.data.DataServiceException: Unable to access UserTransaction in DataService.
      incomingMessage: Flex Message (flex.data.messages.DataMessage)
      operation = transacted
      id = null
      clientId = 24BB268B-BD0B-55FA-B812-A4A640605B9A
      correlationId =
      destination = organization
      messageId = F2415AC4-E1E2-C52C-5E36-CDEB2B903066
      timestamp = 1163095911437
      timeToLive = 0
      body =
      [
      Flex Message (flex.data.messages.DataMessage)
      operation = update
      id = ASObject(3273208){organizationId=10}
      clientId = 581BC236-2220-BCD4-5487-CDE9ECC62A13
      correlationId = F2415AC4-E1E2-C52C-5E36-CDEB2B903066
      destination = organization
      messageId = CEA6DCA3-EFC4-1667-C34B-CDEB2B903976
      timestamp = 0
      timeToLive = 0
      body =
      [

      [
      name
      ],
      com.presidio.organization.Organization@527179,
      com.presidio.organization.Organization@97cd75
      ]
      ]
      hdr(DSEndpoint) = my-secure-http
      errorReply: Flex Message (flex.messaging.messages.ErrorMessage)
      clientId = null
      correlationId = F2415AC4-E1E2-C52C-5E36-CDEB2B903066
      destination = organization
      messageId = 24BB2C0E-DF0C-15ED-1F95-6E66CC6CDB2F
      timestamp = 1163095912015
      timeToLive = 0
      body = null
      code = Server.Processing
      message = Unable to access UserTransaction in DataService.
      details = null
      rootCause = java.lang.ClassCastException: org.objectweb.jotm.Current
      body = null
      extendedData = null

      No method is called on the HibernateAssembler, and as the exception states, it is in the DataService. I'm not sure what this error means and how to fix it.

      The sessionFactories are created in Spring using the org.springframework.orm.hibernate3.LocalSessionFactoryBean. Not sure if that is a factor. I also find it strange that no methods are called to update the item in the assembler. I am assuming that the DataService has to do something before calling the HibernateAssembler method and that is failing.

      Any thoughts?

      Thanks,
      Tom