entity1.setAttributeValue("LastModified", dateTimeHolder)

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

entity1.setAttributeValue("LastModified", dateTimeHolder)

Post by swiftinitpvtltd »

How do I set below value in java api?
entity1.setAttributeValue("LastModified", dateTimeHolder);
Timestamp
org.openadaptor.util.DateTimeHolder
I have data in dateTimeHolder but always inserting null...
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: entity1.setAttributeValue("LastModified", dateTimeHolder

Post by BobK »

First off, the second parameter of setAttributeValue needs to be an Object. So your dateTimeHolder needs to be cast to Object. One way to do that is like:

Code: Select all

entity1.setAttributeValue("LastModified", (Object) dateTimeHolder); 
Also, your code is setting variables within your java program. To actually update the database, you need to do

Code: Select all

engine.updateEntity(this, entity1);
Are you doing that?
Bob
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: entity1.setAttributeValue("LastModified", dateTimeHolder

Post by swiftinitpvtltd »

This worked like a charm! Thank you Bob.
Post Reply