Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update/Insert new VO programatically

JZWLMar 8 2012 — edited Jun 7 2012
Hi all (status newbie),





JDEV version : (Studio Edition Version 11.1.1.5.0)



I would like to have a VO which would insert a new row into a table. I have the VO created for that table based on the table Entity object, How can do an insert into that VO using the ViewDefImpl class from the backend. ( Creating an custom method in the viewImpl class and exposing it to the client option couldn't be used due to some webservice calls that needs to done before the insert operation.)



Current solution I have is like a custom method inside the Viewimpl class and invoke it inside from the Backend (given below) , but then there will some code which touched the Entity object directly which iam trying to avoid.

public custominsertmethod(String variables){



//get enitytdefenition object

//Create a new entity instance and call the commit

CurrencyEOImpl Currency =

(CurrencyEOEOImpl)CurrencyEODefObject.createInstance2(getDBTransaction(),

null);

Currency .setId(questionid);

Currency .setEnglishDescription(desc);

try {

getDBTransaction().commit();

} catch (JboException ex) {

getDBTransaction().rollback();

throw ex;

}

}

now I am able to retrieve the complete VO values like this , Please enlighten me of any major issues that may come with approach at runtime, like performance memory mismanagement or so. etc



if(CurrencyVO().isExecuted()){

while(CurrencyVO().hasNext()){

Row currency = CurrencyVO().next();

//Id ,EnglishDescription

currencyMap.put(currency.getAttribute("Id"), currency.getAttribute("EnglishDescription"));

}



Thanks

JZWL
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2012
Added on Mar 8 2012
8 comments
1,193 views