Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

JPA @Consumed

$
0
0
Hi guys,

I have a route which selects from the database using a JPA entity bean. I
then do some processing on the bean in the route and would like to mark the
bean as processed when the route is complete.

Seems like a pretty typical scenario for me to use @Consumed in my entity
bean. The select works, the processing works but for some reason I don't get
the updates i do in @consumed reflected in the database.

Can someone give me a tip as to why this is not happening.

thanks

Sorry for the long code extract but my route looks like this...

from("direct:itemExport")

//route generics
.routeId("itemExportMagento")
.autoStartup("{{item.export.magento}}")
.startupOrder(2)
.shutdownRoute(ShutdownRoute.Defer)
.errorHandler(deadLetterChannel("log:dead")
.maximumRedeliveries(5)
.retryAttemptedLogLevel(LoggingLevel.ERROR))

//route specifics

.to("jpa://org.apache.camel.auski.etl.entity.ImportPayloadEntity?consumer.namedQuery=queryImportPayloads犉枃穗=false痩=3000犉枋ꇉҞ=false")
.to("itemExportMagentoFromSourceHeaderProcessor")
.to("bean:serviceBean?method=login")
.to("itemExportMagentoFromLoginBodyProcessor")
.split().method("splitterService","magentoUowSplit")
.to("itemExportMagentoActivityCodeProcessor")

// check activity code
.choice()
.when(header(CamelConstants.HEADER_KEY_ITEM_ACTIVITY_CODE)
.endsWith(MinderConstants.ITEM_ADD))
.to("bean:serviceBean?method=createSimpleProduct")
.when(header(CamelConstants.HEADER_KEY_ITEM_ACTIVITY_CODE)
.endsWith(MinderConstants.ITEM_UPDATE))
.to("bean:serviceBean?method=updateSimpleProduct")
.when(header(CamelConstants.HEADER_KEY_ITEM_ACTIVITY_CODE)
.endsWith(MinderConstants.ITEM_DELETE))
.to("bean:serviceBean?method=deleteSimpleProduct")
.otherwise()
.to("log:xml?level=ERROR").stop();

My org.apache.camel.auski.etl.entity.ImportPayloadEntity bean actually
contains another entity bean named
org.apache.camel.auski.etl.entity.ItemEntity. So what I am doing in the
route is selecting import payload entities and then splitting each one up to
process item entities one by one.

Inside createSimpleProduct, updateSimpleProduct and deleteSimpleProduct I
then call markConsumed on the item entity bean and the import entity bean
which are both marked with @Consumed to execute.

@Consumed
public void markConsumed() {
this.setProcessedInd("Y");
this.setProcessedDatetime(new Date());

These fields are not getting set in my db. I also know that it is not trying
to run any sql to update these fields as I have a log of all the sql
executed during execution.

If you have any ideas as to why this is not working I would appreciate it.

Viewing all articles
Browse latest Browse all 5648

Trending Articles