Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

Java Generation Package setting

Avatar

Former Community Member

Hello

I can set the Package for the generated code e.g, com.xyz.entities and can see that the java files are created in that package folder. However when the webapp is deployed  and you see the logs, you will see that the following :-

"Configuring delegate assembler for entity : <ModelName>.package1.<EntityName>

so the assembler expects the entity to have the package <ModelName>.package1.<EntityName> instead of com.xyz.entities.<EntityName>

Upon redeployment of model, packahe1 will change to package2 and so on..

This is breaking my logic because I am using DataServiceTransaction.createItem and passing the entity object to be created. This entity object has package com.xyz.entities.<EntityName> but assembler is expecting it as <ModelName>.package1.<EntityName>

**** Exception *****

[TWSServer]08/24/2011 11:15:31.736 [DEBUG] [Service.Data.Transaction] Started non-jta data service transaction
[TWSServer]08/24/2011 11:15:31.768 [DEBUG] [Service.Data.Transaction] Sending server message to adapter: Flex Message (flex.data.messages.DataMessage)
    operation = create
    id = {currencyId=537}
    clientId = srv:91D4E7AE-B0DB-B0EA-681D-4404F4AC8E96
    correlationId = null
    destination = TraderWorkStation.Currency
    messageId = srv:91D4E7AE-B0DB-B0EA-681D-4404F4AC8E96:0
    timestamp = 1314198931739
    timeToLive = 0
    body = TraderWorkStation.Currency@238
[TWSServer]08/24/2011 11:15:31.771 [DEBUG] [Service.Data.General] Before TraderWorkStation.Currency.createItem (
    (TraderWorkStation.Currency) {currencyId=537} (14308998) {
        currencyName = Dummy Currency
        currencyCode = ABC
        currencyId = 537
        currencyLastUpdated = Wed Aug 24 11:15:31 EDT 2011
    })
[TWSServer]08/24/2011 11:15:31.797 [DEBUG] [Endpoint.AMF] Serializing AMF/HTTP response
Version: 3
  (Message #0 targetURI=/1/onStatus, responseURI=)
    (Typed Object #0 'flex.messaging.messages.ErrorMessage')
      headers = (Object #1)
      rootCause = null
      body = null
      correlationId = "7816F4B3-E6EC-B7CD-A98D-FC5EFF8A3646"
      faultDetail = null
      faultString = "The item of type, 'TraderWorkStation.Currency', passed to the assembler does not match the assembler's configured entity type, 'TraderWorkStation.package1.Currency'.  To convert 'flex.messaging.io.amf.ASObject' to a strong type automatically, set the item-class in the destination."
      clientId = "91D4E4EF-9095-35C3-0E30-0059517696E5"
      timeToLive = 0.0
      destination = "AdminControlService"
      timestamp = 1.314198931792E12
      extendedData = null
      faultCode = "Server.Processing"
      messageId = "91D4EF9D-F0F1-D3D1-5F9B-2F636C098859"

1 Accepted Solution

Avatar

Correct answer by
Level 1

you use the model and Java code generation to generate the Java source code.

however, your model is set for byte code generation instead of source code generation.

it is controlled by the DMS annotation group with the annotation item name "ServerGeneratedEntities"

Change the value to false.

Also you have to be sure that the java source code you generated, was compiled and in the classpath too.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

you use the model and Java code generation to generate the Java source code.

however, your model is set for byte code generation instead of source code generation.

it is controlled by the DMS annotation group with the annotation item name "ServerGeneratedEntities"

Change the value to false.

Also you have to be sure that the java source code you generated, was compiled and in the classpath too.