Is there a way to specify map-payload:column as nullable?

View: New views
5 Messages — Rating Filter:   Alert me  

Is there a way to specify map-payload:column as nullable?

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

   This is my first post and I hope I am posting this to the right forum.

I have a simple program created which takes data from a source table (5 columns, all nullable except ID) and inserts into a copy target table. When I have values in all 5 columns in source table, the copy works fine. But when I have a null value for one of the columns in the target table, I get this error.

Is there a way for me to tell that the #[map-payload:COLUMN3] can be null? Or is using a POJO transformer my best option to resolve this?

I don’t have any transformers created or in place yet. This is a very straight forward select from and insert into type of an operation. I looked through the user guide to resolve this but just wasn’t able to find anything helpful.

Thanks,

-- Ankur

**********************************************************************
INFO  2009-07-02 08:50:44,230 [AppUsageModelIn.2] org.mule.component.simple.LogComponent:
********************************************************************************
* Message received in service: AppUsageModelIn. Content is: '{id=50,           *
* username=testuser1, login_ts=oracle.sql.TIMESTAMP@135133,            *
* column3=null, column4...[100 of 107]'                                   *
********************************************************************************
INFO  2009-07-02 08:50:44,246 [jdbcConnector.dispatcher.1] com.mulesource.mule.transport.jdbc.EEJdbcMessageDispatcher: Connected: endpoint.outbound.jdbc://outboundInsertStatement
ERROR 2009-07-02 08:50:44,246 [jdbcConnector.dispatcher.1] org.mule.DefaultExceptionStrategy: Caught exception in Exception Strategy: Expression Evaluator "map-payload" with expression "COLUMN3" returned null but a value was required.
org.mule.api.expression.RequiredValueException: Expression Evaluator "map-payload" with expression "COLUMN3" returned null but a value was required.
        at org.mule.expression.MapPayloadExpressionEvaluator.getValue(MapPayloadExpressionEvaluator.java:84)
        at org.mule.expression.MapPayloadExpressionEvaluator.evaluate(MapPayloadExpressionEvaluator.java:61)
        at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:170)
        at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:147)
        at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:109)
        at org.mule.transport.jdbc.JdbcConnector.getParams(JdbcConnector.java:314)
        at org.mule.transport.jdbc.sqlstrategy.SimpleUpdateSqlStatementStrategy.executeStatement(SimpleUpdateSqlStatementStrategy.java:53)
        at org.mule.transport.jdbc.JdbcMessageDispatcher.doSend(JdbcMessageDispatcher.java:67)
        at org.mule.transport.jdbc.JdbcMessageDispatcher.doDispatch(JdbcMessageDispatcher.java:54)
        at org.mule.transport.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:262)
        at org.mule.work.WorkerContext.run(WorkerContext.java:310)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)
        at java.lang.Thread.run(Thread.java:619)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Is there a way to specify map-payload:column as nullable?

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What about re-reading the docs? http://www.mulesource.org/display/MULE2USER/Expressions+Configuration+Reference section titled Optional Values.

Good luck! :)
Andrew

Re: Is there a way to specify map-payload:column as nullable?

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the info. I did read the link. I am so new at this so I just didn't get it. So according to the document, is this similar to what I should be doing?

#[map-payload:COLUMN3(*)]

Like I said, I probably am not understanding it completely so that's why I am asking this question.

Thanks again for your help.

Edited by: Ankur B on Jul 2, 2009 11:16 AM

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Is there a way to specify map-payload:column as nullable?

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No, I think you should use #[map-payload:COLUMN3*]

Still, null in JDBC is special, let's see what else turns up after you're over it.

HTH<
Andrew

Re: Is there a way to specify map-payload:column as nullable?

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew - thanks for your help. That worked for me.

Next endeavor for me is to do batch selects and updates to an Oracle DS. Let's see how that goes. I might have more questions coming up soon. :)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email