0

我需要建议。我的服务器应用程序发送未初始化代理的对象。原始类型可以,但 onetomany 等未初始化代理。结果,当检索接收到的对象属性时,我的客户端应用程序一无所获。

这是 src 和 conf 文件的示例,没有 github 上的 libs 项目

这是服务器日志,您可以在其中看到对象已从数据库中检索并使用 proxyinitialized = false 发送

{operation})****************getEnhancements
00:53:36,906 DEBUG http-8080-1 FacadeService:getEnhancements:31 -
collect enhancements
Hibernate:
    select
        this_.id as id1_0_,
        this_.description as descript2_1_0_,
        this_.name as name1_0_,
        this_.priceValue as priceValue1_0_,
        this_.requestedDataFile_id as requeste5_1_0_,
        this_.resultedDataFile_id as resulted6_1_0_
    from
        Enhancement this_
00:53:37,031 DEBUG http-8080-1 FacadeService:getEnhancements:34 -
return enhancements:
[com.garageteam.photoenhancer.model.misc.Enhancement@22,
com.garageteam.photoenhancer.model.misc.Enhancement@25,
com.garageteam.photoenhancer.model.misc.Enhancement@28]
{invoke} 125
{serialize} 15
[BlazeDS]02/14/2012 00:53:37.062 [DEBUG] [Service.Remoting] Adapter
'dpHibernateRemotingAdapter' called
'null.getEnhancements(java.util.Arrays$ArrayList (Collection size:0)
)'
[BlazeDS]02/14/2012 00:53:37.062 [DEBUG] [Service.Remoting] Result:
'java.util.ArrayList (Collection size:3)
  [0] = ASObject(22809745){id=3, uid=206a60dd-2fa6-4a20-bcf4-
bf39684948b5, description=, name=cool, proxyKey=3,
requestedDataFile=ASObject(4002470)
{uid=12283196-3a44-4558-914c-95b3c5443f95, proxyKey=1,
proxyInitialized=false}, resultedDataFile=ASObject(26432381)
{uid=69f842b5-e9b7-4279-be51-3e6c72558aac, proxyKey=2,
proxyInitialized=false}, priceValue=1.0, proxyInitialized=true}
  [1] = ASObject(21904789){id=6, uid=9dc2c08c-
da0b-4047-95ab-0e1a06cf03b7, description=, name=woov, proxyKey=6,
requestedDataFile=ASObject(28121199){uid=1968dfa7-f3d1-41ed-
b55b-47efbe09dfcc, proxyKey=4, proxyInitialized=false},
resultedDataFile=ASObject(18831011){uid=9c3e3c3b-7698-4b01-bcd4-
d58e4e6635a0, proxyKey=5, proxyInitialized=false}, priceValue=2.0,
proxyInitialized=true}
  [2] = ASObject(7405703){id=9, uid=325fe743-4e2c-4d9b-9c01-
ebdb03ad1fea, description=, name=supercool, proxyKey=9,
requestedDataFile=ASObject(14262090){uid=89ee7148-78a0-450a-afe1-
b638a2b40256, proxyKey=7, proxyInitialized=false},
resultedDataFile=ASObject(23654984)
{uid=888141a6-20df-40ed-861d-4968bd5d8042, proxyKey=8,
proxyInitialized=false}, priceValue=3.0, proxyInitialized=true}
'
[BlazeDS]02/14/2012 00:53:37.062 [DEBUG] [Endpoint.AMF] Serializing
AMF/HTTP response
Version: 3
  (Message #0 targetURI=/3/onResult, responseURI=)
    (Typed Object #0 'flex.messaging.messages.AcknowledgeMessage')
      timestamp = 1.329170017062E12
      headers = (Object #1)
      body = (Externalizable Object #2
'flex.messaging.io.ArrayCollection')
        (Array #3)
          [0] = (Typed Object #4
'com.garageteam.photoenhancer.model.misc.Enhancement')
            id = 3
            uid = "206a60dd-2fa6-4a20-bcf4-bf39684948b5"
            description = ""
            name = "cool"
            proxyKey = 3
            requestedDataFile = (Typed Object #5
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "12283196-3a44-4558-914c-95b3c5443f95"
              proxyKey = 1
              proxyInitialized = false
            resultedDataFile = (Typed Object #6
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "69f842b5-e9b7-4279-be51-3e6c72558aac"
              proxyKey = 2
              proxyInitialized = false
            priceValue = 1.0
            proxyInitialized = true
          [1] = (Typed Object #7
'com.garageteam.photoenhancer.model.misc.Enhancement')
            id = 6
            uid = "9dc2c08c-da0b-4047-95ab-0e1a06cf03b7"
            description = ""
            name = "woov"
            proxyKey = 6
            requestedDataFile = (Typed Object #8
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "1968dfa7-f3d1-41ed-b55b-47efbe09dfcc"
              proxyKey = 4
              proxyInitialized = false
            resultedDataFile = (Typed Object #9
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "9c3e3c3b-7698-4b01-bcd4-d58e4e6635a0"
              proxyKey = 5
              proxyInitialized = false
            priceValue = 2.0
            proxyInitialized = true
          [2] = (Typed Object #10
'com.garageteam.photoenhancer.model.misc.Enhancement')
            id = 9
            uid = "325fe743-4e2c-4d9b-9c01-ebdb03ad1fea"
            description = ""
            name = "supercool"
            proxyKey = 9
            requestedDataFile = (Typed Object #11
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "89ee7148-78a0-450a-afe1-b638a2b40256"
              proxyKey = 7
              proxyInitialized = false
            resultedDataFile = (Typed Object #12
'com.garageteam.photoenhancer.model.misc.DataFile')
              uid = "888141a6-20df-40ed-861d-4968bd5d8042"
              proxyKey = 8
              proxyInitialized = false
            priceValue = 3.0
            proxyInitialized = true
      correlationId = "A01CE051-DFDD-6914-4308-78B4E961321B"
      messageId = "8BB1B217-C60E-32D4-9FD3-7A9BB427085E"
      timeToLive = 0.0
      clientId = "8AE5EEA5-0008-798D-0980-4DC9F378C296"
      destination = null

00:53:37,093 DEBUG http-8080-1 DispatcherServlet:doDispatch:822 - Null
ModelAndView returned to DispatcherServlet with name
'springMessageBroker': assuming HandlerAdapter completed request
handling
00:53:37,093 DEBUG http-8080-1 DispatcherServlet:processRequest:674 -
Successfully completed request 
4

1 回答 1

1

您使用的是 dpHibernate RemoteObject 对象还是标准的 flex/blazeds RemoteObject 标签。看起来服务器正在返回正确的代理对象,所以问题应该出在客户端。如果您没有使用 dpHibernate RemoteObject 标记发出请求,则 dpHibernate 无法为您代理加载惰性项。还可以使用服务捕获之类的工具来查看是否正在发生对服务器的回调,以及是否从您的加载方法返回服务器错误。

于 2012-02-28T22:03:25.940 回答