tag:blogger.com,1999:blog-7039183198232083459.post2289035788331450741..comments2024-03-27T22:39:18.877-07:00Comments on Sameh Nassar: Calling SQL Statment Inside Java CodeSameh Nassarhttp://www.blogger.com/profile/00631672031060314535noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-7039183198232083459.post-67746341758474626472014-05-09T06:47:14.814-07:002014-05-09T06:47:14.814-07:00Hi,
First: don't forget to close rs and stat i...Hi,<br />First: don't forget to close rs and stat in finally block.<br /><br />Second: how you call the method in AppModuleImpl from bean??<br />You can't instantiate an application module to access method. you should expose the method to the clientinterface of the application module and add it in the pageDef. then you can call this method like:<br />BindingContainer bindingContainer= BindingContext.getCurrent().getCurrentBindingsEntry();<br />OperationBinding operationBinding=bindingContainer.getOperationBinding("methodAction");<br />operationBinding.execute();<br /><br />or you can move this method from AM and add it directin beanSameh Nassarhttps://www.blogger.com/profile/00631672031060314535noreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-21413999758578897152014-05-09T01:37:52.563-07:002014-05-09T01:37:52.563-07:00dear Sameh
its good post and Iam confusing where...dear Sameh <br /><br />its good post and Iam confusing where I can wright my code<br />example<br />I wrote this method<br /><br /> public String getEname(int empid){<br /> String fname="";<br /> ResultSet rs;<br /> String plSql="Select first_name from employees where employee_id=?";<br /> DBTransaction trans =getDBTransaction();<br /> CallableStatement stat=null;<br /> stat=trans.createCallableStatement(plSql,2);<br /> try {<br /> stat.setInt(1,empid);<br /> rs=stat.executeQuery();<br /> while(rs.next())<br /> {<br /> fname=rs.getString("first_name");<br /> }<br /> } catch (Exception e) {<br /> // TODO: Add catch code<br /> e.printStackTrace();<br /> } finally {<br /> }<br /> return fname;<br /> } <br /><br />In AppModuleImpl<br />and create my page and <br />I try to call it from page bean <br />I got this error message<br /><br />Application module AppModuleImpl_151 is not a root app module but has no parent<br /><br /><br />appreciate your help<br />Anonymoushttps://www.blogger.com/profile/14916280397012752956noreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-10934609955001719132013-12-31T14:38:55.597-08:002013-12-31T14:38:55.597-08:00Hi,
ADFUtils class comes with Fusion Order Demo a...Hi,<br />ADFUtils class comes with Fusion Order Demo application you can download application from<br />http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html<br /> and take ADFUtils.java class. any where you this method<br /> public static ApplicationModule getApplicationModuleForDataControl(String name) <br /> {<br /> FacesContext facesContext = getFacesContext();<br /> Application app = facesContext.getApplication();<br /> ExpressionFactory elFactory = app.getExpressionFactory();<br /> ELContext elContext = facesContext.getELContext();<br /> ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{data." + name + ".dataProvider}", Object.class);<br /> return (ApplicationModule) valueExp.getValue(elContext);<br /> }Sameh Nassarhttps://www.blogger.com/profile/00631672031060314535noreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-34146336413541519822013-12-30T04:34:09.229-08:002013-12-30T04:34:09.229-08:00Dear Sameh,
Nice post,
But I 've problem with...Dear Sameh, <br />Nice post,<br />But I 've problem with<br /><br />public AppModuleImpl getAm()<br />{<br />AppModuleImpl am =<br />(AppModuleImpl) ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");<br />return am;<br />}<br /><br />I put this method in the AppModuleImpl code<br />but I got error within<br />ADFUtils<br />Not found !!<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-2169129310942820402010-12-23T09:47:17.695-08:002010-12-23T09:47:17.695-08:00Nice post
Regards
KarimNice post<br /><br />Regards<br />KarimKarim Hasan Abdellatifhttps://www.blogger.com/profile/12918391035586846177noreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-31297913428199047772010-12-11T00:47:47.661-08:002010-12-11T00:47:47.661-08:00Hi Suresh,
getAm() is a method that return your Ap...Hi Suresh,<br />getAm() is a method that return your Application Module. In getAm() method you should write your Data Control Name as "AppModuleDataControl" so the method will be<br />public AppModuleImpl getAm()<br />{<br />AppModuleImpl am =<br />(AppModuleImpl) ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");<br />return am;<br />} <br /><br />and about this line :<br />stat = getAm().getDbtConnection().createPreparedStatement(sql, 1);<br /><br />I modified it to<br />stat = getAm().getDBTransaction().createPreparedStatement(sql, 1);<br /><br />because Application Module has a DBTransaction Not DbtConnection.Sameh Nassarhttps://www.blogger.com/profile/00631672031060314535noreply@blogger.comtag:blogger.com,1999:blog-7039183198232083459.post-71332226283475657082010-12-10T22:42:02.077-08:002010-12-10T22:42:02.077-08:00As in your post used getAm().getDbtConnection()
ho...As in your post used getAm().getDbtConnection()<br />how we can create and wht is it Can you expain.Suresh Velagapudihttps://www.blogger.com/profile/08915194457986352297noreply@blogger.com