How to execute the query of a View object in the doDML() method?
Dear allI'm new with ADF.
I have a READ ONLY display object called CurrencyRatevo.
Select f_get_rate(:p_cur_id) From Dual
This VO calculates the rate of change.And I have a "ExpenseTransaction" entity object for expenditure operations. This EO contains an attribute called "CurrRate" for the exchange rate.
This attribute must be filled automatically before saving it.
I like to write code in the method doDml() to populate the attribute 'CurrRate' of the result of the 'CurrencyRatevo '.
protected void doDML(int operation, TransactionEvent e) {
super.doDML(operation, e);
// after insert operation
// I want to get the result of the "CurrencyRatevo". and populate the attribute" CurrencyRatevo"
}
}
Can someone help me to cela, or has another solution?Thank you
@santosh
David wrote: well Yes... you can not access the vo eo...
That is not exactly true.
@ta *.
>
I like to write code in the method doDml() to populate the attribute 'CurrRate' of the result of the 'CurrencyRatevo '.
>
You can do by following these steps:
1 - go to the entity of ExpenseTransaction and accessors in view an accessor to add to CurrencyRatevo.
2 - override doDML () method, something like this code
@Override
protected void doDML(int i, TransactionEvent transactionEvent) {
if(i==EntityImpl.DML_INSERT)
{
RowSet departmentsView1 = this.getDepartmentsView1(); //replace this with your ViewAccessorName
departmentsView1.setNamedWhereClauseParam("p_cur_id", 10);
departmentsView1.executeQuery();
DepartmentsViewRowImpl first = (DepartmentsViewRowImpl)departmentsView1.first();
this.setCurrencyRatevo(first.getDepartmentName());
}
super.doDML(i, transactionEvent);
}
Published by: Mohammad Jabr on April 26, 2012 11:18
Tags: Java
Similar Questions
-
Mr President
Jdev worm is 12.2.1
How to modify and update a line later was inserted and updated in the doDML() method?
I added two rows in my table a method of action-listener in bean managed and secondly with operation doDML() as below.
Method 1-first row in managed bean
public void addNewPurchaseVoucher(ActionEvent actionEvent) { // Add event code here... BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator"); RowSetIterator rsi = dciter.getRowSetIterator(); Row lastRow = rsi.last(); int lastRowIndex = rsi.getRangeIndexOf(lastRow); Row newRow = rsi.createRow(); newRow.setNewRowState(Row.STATUS_NEW); rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow); rsi.setCurrentRow(newRow); BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator"); RowSetIterator rsi1 = dciter1.getRowSetIterator(); Row lastRow1 = rsi1.last(); int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1); Row newRow1 = rsi1.createRow(); newRow1.setNewRowState(Row.STATUS_NEW); rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1); rsi1.setCurrentRow(newRow1); }
Method of doDML() of line 2 seconds in the entityImpl class
protected void doDML(int operation, TransactionEvent e) { setAmount(getPurqty().multiply(getUnitpurprice())); if (operation == DML_INSERT) { insertSecondRowInDatabase(getVid(),getLineitem(),getDebitst(), (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } if(operation == DML_UPDATE) { updateSecondRowInDatabase(getVid(),getLineitem(),getDebitst(), (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } super.doDML(operation, e); } private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4) { PreparedStatement stat = null; try { String sql = "Insert into vdet (VID,LINEITEM,DEBITST,AMOUNT) values ('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "')"; System.out.println("sql= " + sql); stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } } private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4) { PreparedStatement stat = null; try { String sql = "update vdet set vid='"+ value1+"',lineitem='"+ value2+"',DEBITST='" + value3 + "', AMOUNT='" + value4 + "' where VID='" + VID + "'"; System.out.println("sql= " + sql); stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } }
Now the problem is that when later I change the quantity and price of the first line isn't updated but second row, because I used the command
<af:button actionListener="#{bindings.Commit.execute}" text="Commit"
This button update the first line added by bean managed, but the second row remains unchanged.
Please help how to update the two lines with the same button or something else.
Concerning
DML_UPDATE will call only if there is some change data attributes.
I guess that the update statement is false because vid looks like a primary key for the table, then, how update you the primary key of the update statement and how the update condition statement where the vid = '0'
I assume the update statement should look like:
private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4) { PreparedStatement stat = null; try { String sql = "update vdet set lineitem='" + value2 + "',DEBITST='" + value3 + "', AMOUNT='" + value4 + "' where VID='" + value1 + "'"; System.out.println("sql= " + sql); stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } }
-
I want to execute a specific request, but I have no idea about this please someone help me how to a specific query, run?
Try this.
Yes you can write this in next item key of you text element.
Go_Block ('Your_Block_Name');
Set_Block_Property ('Your_Block_Name', DEFAULT_WHERE, 'STUDENT_ID =' |: STUDENT_ID);
Execute_Query (No_Validate);
-
How to execute the method of dialogue of the handler of a button?
I created my first dialog of the samples, but I can't find how to execute a method in my handler of a button dialog box. Can someone tell me please in the right direction?
function CreateDialog()
{
this.windowRef = null;
}
CreateDialog.prototype.run = function()
{
.. .floating a lot of vars
Create a palette type window.
var win = new window ('dialogue', 'Spray generator Element', [iTop ILeft then, iWidth, ILeft iTop then + iHauteur]); Bounds = [left, top, right, bottom]
this.windowRef = win;
Add a frame to the content.
win.btnPanel = win.add ("panel", [iPadding, iPadding, iWidth-iPadding, iHauteur-iPadding], "");
... Add a bunch of other things...
win.btnAdd = win.btnPanel.add ('button', [win.btnRemove.bounds.left - iPadding - iButtonWidth, win.lstImages.bounds.bottom, + iSmPadding, win.btnRemove.bounds.left - iPadding, win.lstImages.bounds.bottom + iSmPadding + iTextHeight], "add");
win.btnAdd.onClick = function() {}
TODO implement this
var f is File.openDialog ("open a file");.
win.lstImages.add ("item", f.displayName);
This. EnableControls(); <-problem is on this line here!
};
This. EnableControls(); <-this works
Display the window
Win.Show ();
Returns true;
}
CreateDialog.prototype.EnableControls = function () {}
var result = true;
result = result & & (this.windowRef.ddlPaths.selection! = "");
result = result & & (this.windowRef.lstImages.items.length > 0);
this.windowRef.btnOK.enabled = result;
}I posted a response to this here: http://ps-scripts.com/bb/viewtopic.php?t=2889
X
-
How to execute the sql statement in the file beats?
I want to execute after the statement
C:\ > sqlplus/nolog
SQL > conn scott/tiger
SQL > select * from tab;
I know I can achieve it following test.bat and testdb.sql file
test.bat is:
sqlplus/nolog @testdb.sql
TestDB.SQL is:
Conn scott/tiger
Select * from tab;
Now I don't want to use the sql file, I want only use bat file, as follows:
test.bat is:
sqlplus/nolog
Conn scott/tiger
Select * from tab;
When I run test.bat, I find only one sqlplus /nolog execute statement, do not execute other statements.
(1) I want to know if there is a method to run the SQL file by fighting without a sql file? How to make it happen?
(2) if I call the sql file, how to hide the password of user? Because I don't want other people to know scott password, if I use conn scott/tiger in testdb.sql, other person can see testdb.sql and the password. Is there a good way to avoid?
Thank you!It works a bit different in Windows. Create a file is like this:
( echo conn scott/tiger@orcl echo spool c:\temp\list.txt echo select sysdate from dual; echo spool off echo exit ) | sqlplus -s -l /nolog
-
How to execute the pl/sql block from a file
Hi all
can someone tell me how to execute a pl/sql block to a file.it does contain no procedures.it is of the form
-Start
-says
-end;
ThanxOk.. If the time points? :)
See you soon!
Bobin -
How to use the post method?
Hello
I need to send an image on the server using the post method.
I connect using Http, like this:
HttpConnection _http = (HttpConnection) Connector.open (address);
can someone provide an example of how can I use a post method to send the data to the server?
Kind regards
I solved the problem. Here is my code, which works:
Bitmap _bitmap = new Bitmap(Display.getWidth(), Display.getHeight()); Display.screenshot(_bitmap); JPEGEncodedImage _jpg = JPEGEncodedImage.encode(_bitmap, 20); DataBuffer _db = new DataBuffer(); _db.write(_jpg.getData()); _http = (HttpConnection) Connector.open(_url, Connector.READ_WRITE); _http.setRequestMethod("POST"); _http.openOutputStream().write(_db.toArray()); _http.getResponseCode();
Kind regards
-
How to bind the AM method to EL
I want to connect the AM method in EL expression to control the user interface component attribute made,.
{in my AM I create a method and expose this data control method, rendering for the UI component attribute is defined as that "rendered =" #{bindings.isRayTesting.result ""} ", it seems that this method cannot be performed until the page is rendered,
How do I make the excute method before the page is rendered.
the AM method
for example:
public boolean isRayTesting() {} Returns false; } {in my AM I create a method and expose this data control method, rendering for the UI component attribute is defined as that "rendered =" #{bindings.isRayTesting.result ""} ", it seems that this method cannot be performed until the page is rendered,
To call the method that is exposed in the pagedef using EL, you need something like: #{bindings.isRayTesting. {Run} so there is no way to implement your use case using only the EL.
Check this post for alternatives: https://blogs.oracle.com/adf/entry/an_epic_question_how_to
Also, many of the properties of the JSF component (as "lent") are evaluated several times in the life cycle JSF request so an expensive operation in them can significantly degrade performance.
Dario
-
How to use the find method to search for multiple items in a single paragraph?
I'm desigining a script to find all instances where ctrl + b and ctrl + i are applied to body text and then replace the format of these characters replaced with chartag italic or bold. Here's what the script is supposed to do:
- put the find method in a while loop that overrides seeks format character.
- If a substitution of format character is found, pass the text range returned by the find method and the CharPropsChange flag in the GetTextForRange method.
- Use a Boolean comparison between the idata of the text element to the angle of character and character constant weight.
- What that is the boolean is set to true, and then use the SetTextProp method to set the properties of the text range for the italic or bold character tag properties.
This script works on the substitution of format first character found however it ignores other substitutions in the same paragraph. The cause of this is that the while loop updated the line of text control used by the find method for the following paragraph in the stream. I think I need to add an inner loop that runs through all the text in a single paragraph, where teaching iteration the loc text used by the find method is based on the same paragraph, but the offset is changed. I don't know how to do this.
function removeOverrides (RPSC)
{
var vDocStart = pDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
var vBoldFmt = getCharFmt (RPSC, "Bold")
var vItalicFmt = getCharFmt (RPSC, 'Italic')
initFA_errno ();
While (FA_errno is constant .FE_Success)
{
var vTextLoc = new TextLoc(vDocStart,0);
var vFindParams = findOverrideParams (CDRP);
var vTextRange = pDoc.Find (vTextLoc, vFindParams);
If (vTextRange.beg.obj.ObjectValid ())
{
var vTextItems = pDoc.GetTextForRange (vTextRange, Constants.FTI_CharPropsChange)
If (vTextItems.length ==! 0)
{
If (vTextItems [0] .idata == constant .FTF_WEIGHT)
{
pDoc.SetTextProps (vTextRange, vBoldFmt.GetProps ())
}
If (vTextItems [0] .idata == constant .FTF_ANGLE)
{
pDoc.SetTextProps (vTextRange, vItalicFmt.GetProps ())
}
} else (Log (vLogFileName, ' \nERROR: none of the items were found in the table in text format but alternative size were found: ' + pDoc.Name))
}
vDocStart = vDocStart.NextPgfInFlow;
}
}
function findOverrideParams (RPSC)
{
var vFindParams = AllocatePropVals (1);
vFindParams [0].propIdent.num = Constants.FS_FindObject;
vFindParams [0].propVal.valType = Constants.FT_Integer;
vFindParams [0].propVal.ival = Constants.FV_FindCharacterFormatOverride;
Return vFindParams;
}
Another approach (which is what I usually did) is after the first search to set vTextLoc = vTextRange.end
Whatever it is, you might consider moving your initialization of vTextLoc and vFindParams outside the while loop. The settings do not change, why redefine them for each search?
-
How to use the find method to search for character format substitutions and FMP?
I strongly suspect that I should be able to use the find method to search for paragraph substitutions and format as these options are available in the Find dialog box. However, because of the excruciating Extendscript documentation from Adobe, I not was able to find the key pieces of information that I need. I found these constants:
- Constants.FV_FindPgfFormatOverride
- Constants.FV_FindCharacterFormatOverride
But he has literally no information about them. It is not yet a definition, so I'm actually just a guess. However, I think that I need to somehow use these constant within the parameters of the Find method. Any ideas on how to do it?
You're right, there are still some bugs to work out of the documentation, although it has already improved since I started w / Extendscript last summer.
Find two constants must be defined as the ival for a PropVal FindObject, for example:
var myDoc is app. ActiveDoc;
var docStart = myDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
tloc var = new TextLoc(docStart,0);
var findParams = AllocatePropVals (1);
findParams [0].propIdent.num = Constants.FS_FindObject;
findParams [0].propVal.valType = Constants.FT_Integer;
findParams [0].propVal.ival = Constants.FV_FindCharacterFormatOverride;
myDoc.Find (tloc, findParams);
Depending on what you're trying to accomplish, you can also take a look at the property FormatOverride of the Doc, bmp and item objects.
-
Connector WFD SDK - how to call the server method?
I use the FMS connector C++ to perform editing work. And I am obliged to call a method side server.
I tried to use the INetConnection::call () method, but it seems to be successful.
The specification of the server FMS told me to do,1. call the server method,
NC. Call (streamname, null, "FCPublish");
2. implement a callback function onFCPublsihnc.onFCPublish = function (info) {...}
How can I implement the latter with FMS Connector C++?
The FMS connector document include a subject too little on the method call server-side.
WFD SDK connector, the netconnection call prototype looks like this.
virtual bool call (const char * funcName, const unsigned char * arguments, unsigned size, OnResultHandler * result) = 0;
Thus, you will have to serialize the arguments and then pass it to call the function.
Check
bool FMSCTester::testCall (const char * cmd, const char * arg)
method in FMSCTester sample application that comes with the software development kit how to serialize and call the function.
For Server callbacks, you have to implement a netconnection sink with the onCommand method is called when the server calls a method on the client.
The onCommand prototype looks like this,
onCommand Sub (const char * cmd, const unsigned char * arguments, unsigned bufLen, IRetValue * retVal)
again, you can check the MyNCSink class in the FMSCTester sample project for an implementation of onCommand.
-
How to reproduce the traditional method in RMAN?
How can I do the following by using RMAN?
DB version 10.2.0.4
in the past I have moved large data bases of 1 server to another with downtime of 5 minutes using backups made the old way to put tablespaces into backup mode and to make copies of data files.
RedHat 5.2
I'm not using a rman catalog
I used the following method:
= > Part 1
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "VPMY" RESETLOGS ARCHIVELOG value
MAXLOGFILES 32
MAXLOGMEMBERS 3
.. .etc
LOGFILE
... save file names
DATA FILE
... list data files
US7ASCII CHARACTER SET;
= > Part 2
Until the downtime scheduled, I copy logs archiving from the production server to the new, and run the following command to apply the last archiving logs:
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
-> AUTO < -.
= > Part 3
After you apply the last archive log all restrict mode.
ALTER DATABASE OPEN resetlogs;
My question is, how do I part 2 in RMAN. I managed to duplicate databases and restore databases with rman to another server, but this obviously covers only the data to the point of backup. How can I make the elements above 1-3 with downtime of about 5 minutes like I did using old methods?
Any help is very appreciated.+= ==> Part 2 +.
Until the downtime scheduled, I copy logs archiving from the production server to the new, and run the following command to apply the last archiving logs:
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
-> AUTO<>
My question is, how do I part 2 in RMAN.When you run this game with rman, you just run rman > restore database if archivelogs placed (or transfer) another directory before running the recovery you need to catalogue start with "arch_location" through rman
I managed to duplicate databases and restore databases with rman to another server, but this obviously covers only the data to the point of backup. How can I make the elements above 1-3 with downtime of about 5 minutes like I did using old methods?
I don't think this limit. But in mode archivelog (in your case), you can take (hot) backup with rman even while the database is open. You can try as below
rman target / configure controlfile autobackup on; backup database plus archivelog
Then copy (transfer) these files to the new server, backup and
export ORACLE_SID=
rman target / startup nomount; restore spfile from 'autobackup_location'; startup force nomount; restore controlfile from 'autobackup_location'; alter database mount; catalog start with 'bakup_location'; restore database; recover database; alter database open resetlogs; Published by: Alex on August 12, 2010 02:45
-
How to stop the Action method when an Exception occur in another method
Hi all
{} public void action (event clientEvent)
startAction();
JOptionPane.showMessageDialog (null, getDocumnetId());
}
How to stop the action of the method ("action"), if an exception occurs in the method ("startAction")
(if the exception to happen we didn't need to show the JOption Message)Hello
Try FacesContext.getCurrentInstance () .renderResponse ();
Frank
-
How to execute the query automatically when a query is added, Panel
Hello
Jdev: 12.1.3
I added a queryPanel (af:query) on my Page. Everything works fine when I do a search.
I wish I had the original Version to run the query that is executed automatically when loading the page. How can this be achieved?
What I have to do this explicitly, or is it a property that I can use?
See you soon
AJ
You can generate the default display criteria again, setting the mode to automatic query.
You generate default criteria by adding each attribute to a criterion without specifying and literal bind variable.
Timo
-
How to execute the SQL statement in the Application Module
Hi people
I´d would like to know how I can execute a SQL statement like "remove user" in the Module to request... prepareSession method...
I m using Jdev 10 with ADF Faces
Thank youThis is possible, but you should think twice about it.
If this can be done with an EO/VO do in this way.
If you can't do it with an EO/VO you can yourself the DB operation (ApplicationModule.getDBTransaction ()) and use a call of createStatement (...) do what you want.Timo
Maybe you are looking for
-
Get this error message: reference #30.9079ccc.1416414297.9e80d60
Went to sears.com and put four tires in the basket. When I clicked on the "order" button I get the following error message: reference #30.9079ccc.1416414297.9e80d60 Weird because last week I performed this operation without problem.
-
Win7 drivers for Pavilion 15-n097ea
Hello I recently installed win7 on my Pavilion n-15e092ea, which I was able to do it with the help of Paul_Tikkanen here, now a friend also - disgruntled with win8 - asked me to install win7 on her very similar laptop, Pavilion 15-n097ea, can someone
-
BlackBerry Smartphones MMS DELIVERY/READ/RECOVERY
Hi all!! I have a BB 9310 Curve.wirh Boost Mobile. When to send MMS, the receiver must be in an area of coverage (any business) seized can show delivered (box D) on the end of the sender? What means do they have to have a certain signal strength in o
-
I use Adobe Premiere elements 13 and I have a problem. I want to record a police so that all my projects will have the same font (I use a font I have to manually adjust the color of it and thus re making it each time will be a problem because I can n
-
performance degrades after the collection of statistics
Oracle 11 g 2 OEL 5 We have several very large tables (40 million lines and more) and recently we gathered stats on tables and it degraded our performance. He began to do table scans complete rather than use the index. The same queries are very well