mulesoft / docs-connectors

Documentation for connectors
BSD 3-Clause "New" or "Revised" License
25 stars 126 forks source link

W-13589088 Database Connector Data Types Examples - Parameter Types | How to write as **Expression or Bean reference** #2050

Open AndyDaSilva52 opened 2 years ago

AndyDaSilva52 commented 2 years ago

None of the docs below helps to understand how to write an Expression or Bean reference for the Parameter Types, when using for example the Insert operation of the Database Connector

I had tried the right definition:

[{'key': "ID", 'type': "LONGNVARCHAR"}]

The XML:

    <db:insert doc:name="Insert" doc:id="4ee50969-884b-4eb7-93e0-adca25229683" 
        config-ref="Database_Config_Oracle"
        queryTimeoutUnit="DAYS" 
        autoGenerateKeys="true" 
        parameterTypes="#[[{'key': &quot;ID&quot;, 'type': &quot;LONGNVARCHAR&quot;}]]">
        <db:sql><![CDATA[#[ vars.db.query ]]]></db:sql>
        <db:input-parameters><![CDATA[#[vars.db.inputParameters]]]></db:input-parameters>
        <db:auto-generated-keys-column-names />
    </db:insert>

The error using the example is:

""java.lang.IllegalStateException - No read or write handler for type
java.lang.IllegalStateException: No read or write handler for type
    at org.mule.weave.v2.module.pojo.reader.PropertyDefinition._type$lzycompute(PropertyDefinition.scala:44)
    at org.mule.weave.v2.module.pojo.reader.PropertyDefinition._type(PropertyDefinition.scala:35)
    at org.mule.weave.v2.module.pojo.reader.PropertyDefinition.classType(PropertyDefinition.scala:70)
    at org.mule.weave.v2.module.pojo.writer.entry.BeanPropertyEntry.entryType(BeanPropertyEntry.scala:24)
    at org.mule.weave.v2.module.pojo.writer.WriterEntry.putValue(WriterEntry.scala:18)
    at org.mule.weave.v2.module.pojo.writer.WriterEntry.putValue$(WriterEntry.scala:11)
    at org.mule.weave.v2.module.pojo.writer.entry.BeanPropertyEntry.putValue(BeanPropertyEntry.scala:19)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.write(JavaWriter.scala:62)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.writeSimpleJavaValue(JavaWriter.scala:419)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.doWriteValue(JavaWriter.scala:268)
    at org.mule.weave.v2.module.writer.WriterWithAttributes.internalWriteValue(WriterWithAttributes.scala:35)
    at org.mule.weave.v2.module.writer.WriterWithAttributes.internalWriteValue$(WriterWithAttributes.scala:34)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.internalWriteValue(JavaWriter.scala:44)
    at org.mule.weave.v2.module.writer.WriterWithAttributes.writeAttributesAndValue(WriterWithAttributes.scala:30)
    at org.mule.weave.v2.module.writer.WriterWithAttributes.writeAttributesAndValue$(WriterWithAttributes.scala:15)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.writeAttributesAndValue(JavaWriter.scala:44)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.doWriteValue(JavaWriter.scala:241)
    at org.mule.weave.v2.module.writer.Writer.writeValue(Writer.scala:65)
    at org.mule.weave.v2.module.writer.Writer.writeValue$(Writer.scala:46)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.writeValue(JavaWriter.scala:44)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.doWriteValue(JavaWriter.scala:216)
    at org.mule.weave.v2.module.writer.Writer.writeValue(Writer.scala:65)
    at org.mule.weave.v2.module.writer.Writer.writeValue$(Writer.scala:46)
    at org.mule.weave.v2.module.pojo.writer.JavaWriter.writeValue(JavaWriter.scala:44)
    at org.mule.weave.v2.module.java.JavaInvocationHelper$.transformToJavaCollection(JavaInvokeFunction.scala:105)
    at org.mule.weave.v2.el.utils.DataTypeHelper$.transformToJava(DataTypeHelper.scala:166)
    at org.mule.weave.v2.el.utils.DataTypeHelper$.transformToJavaDataType(DataTypeHelper.scala:153)
    at org.mule.weave.v2.el.utils.DataTypeHelper$.toJavaValue(DataTypeHelper.scala:104)
    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluate(WeaveExpressionLanguageSession.scala:253)
    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.$anonfun$evaluate$4(WeaveExpressionLanguageSession.scala:135)
    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.doEvaluate(WeaveExpressionLanguageSession.scala:268)
    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluate(WeaveExpressionLanguageSession.scala:134)
    at org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor$1.evaluate(DataWeaveExpressionLanguageAdaptor.java:321)
    at org.mule.runtime.core.internal.el.DefaultExpressionManagerSession.evaluate(DefaultExpressionManagerSession.java:117)
    at org.mule.runtime.core.privileged.util.attribute.ExpressionAttributeEvaluatorDelegate.resolveExpressionWithSession(ExpressionAttributeEvaluatorDelegate.java:68)
    at org.mule.runtime.core.privileged.util.attribute.ExpressionAttributeEvaluatorDelegate.resolve(ExpressionAttributeEvaluatorDelegate.java:56)
    at org.mule.runtime.core.privileged.util.AttributeEvaluator.resolveTypedValue(AttributeEvaluator.java:107)
    at org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionValueResolver.resolveTypedValue(ExpressionValueResolver.java:115)
    at org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionValueResolver.resolve(ExpressionValueResolver.java:99)
    at org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeValueResolverWrapper.lambda$initialise$0(TypeSafeValueResolverWrapper.java:69)
    at org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeValueResolverWrapper.resolve(TypeSafeValueResolverWrapper.java:52)
    at org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeExpressionValueResolver.resolve(TypeSafeExpressionValueResolver.java:73)
    at org.mule.runtime.module.extension.internal.runtime.resolver.ResolverUtils.resolveRecursively(ResolverUtils.java:92)
    at org.mule.runtime.module.extension.internal.runtime.resolver.ResolverSet.resolve(ResolverSet.java:113)
    at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.getResolutionResult(ComponentMessageProcessor.java:1258)
    at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.addContextToEvent(ComponentMessageProcessor.java:762)
    at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.lambda$null$5(ComponentMessageProcessor.java:354)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:273)
    at reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.onNext(FluxPeekFuseable.java:496)
    at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:490)
    at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:485)
    at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:127)
    at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
    at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:351)
    at reactor.core.publisher.FluxSubscribeOnValue$ScheduledScalar.run(FluxSubscribeOnValue.java:178)
    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50)
    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:151)
    at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748), while writing Java at 
1| [{'key': "ID", 'type': "LONGNVARCHAR"}]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
1| [{'key': "ID", 'type': "LONGNVARCHAR"}]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Trace:
  at anonymous::main (line: 1, column: 2)" evaluating expression: "[{'key': "ID", 'type': "LONGNVARCHAR"}]"."

How can we know the right way to write this Expression or Bean reference ?

185223685-4efef3a3-e39c-4705-bc10-8747bf1c3eae_image_print_studio_parameter-types_database_connector-mule

valkyrie69 commented 1 year ago

@kevintroller Can you open a ticket for this to confirm with dev?

AndyDaSilva52 commented 1 year ago

@kevintroller Can you open a ticket for this to confirm with dev?

Do you know how I can open a case? Do I need to post on Issues | Known Issues (salesforce.com) ?

I tried to use the documentation How to Log a New Support Case in the MuleSoft Help Center | MuleSoft Help Center (help.mulesoft.com), but it seems outdated.

kevintroller commented 1 year ago

Hi @AndyDaSilva52 I already opened a case with the dev team and currently investigating.

AndyDaSilva52 commented 1 year ago

In Studio, the graphical view can help to identify the structure for Parameter Types

image

image

output application/java
---
[{
    key: '' as String,
    typeClassifier: {
        "type": '' as String,
        customType: '' as String
    }
} as Object {
    class : "org.mule.extension.db.api.param.ParameterType"
}]
kevintroller commented 1 year ago

Thank you, @AndyDaSilva52 I'll pass this along to the dev team.

kevintroller commented 11 months ago

Hi @AndyDaSilva52 Could you please report a Support case with this request? Please log a ticket to our Support team following these steps: https://help.mulesoft.com/s/article/How-to-log-a-new-support-case The Support team will perform an initial investigation and test the connector behavior with the parameters for then us be able to document the missing information. Thank you.