GetDBTransaction

dear All
i am trying to execute a stored procedure in this class
*public void get_data () throws SQLException {*
PreparedStatement st;
String sql = "begin pkg.TEST(X,Y); END;";
*try{*
st = getDBTransaction().createPreparedStatement(sql, 0);
st.setObject(1, 1);
st.setObject(2, 1);
st.executeUpdate();
*catch (JboException x){*
System.out.println(x.getMessage());
but i get this problem when i will run this class in a button.     
Unexpected exception caught: java.lang.NullPointerException, msg=null
can any one help me ?

first thatnks very much for your response
first i remove all parameters from test procedure and code now is
public void get_data () {
PreparedStatement st;
String sql = "begin PKG.TEST; END;";
try{
st = getDBTransaction().createPreparedStatement(sql, 0);
st.setObject(1, 1);
st.setObject(2, 1);
st.executeUpdate();
catch (JboException x){
System.out.println(x.getMessage());
Still Same Problem, getDBTransaction() returns null !!!!!!!!!!!!!

Similar Messages

  • How to Use getDBTransaction() in Controller Class

    I am using the below code.
         OADBTransaction tx = (OADBTransaction)getDBTransaction();
                             java.sql.Connection pConncection = tx.getJdbcConnection();
                   ConcurrentRequest cr = new ConcurrentRequest(pConncection);
    But receiving the below error method getDBTransaction not found in class cust.oracle.apps.pos.changeorder.webui.extendViewOrderPGCO
    Should I extend AM and use this code in AM or can I use this code in extended Controller.
    Thanks for your help.
    HP.

    OADBTransaction tx = (OADBTransaction)getDBTransaction();
    java.sql.Connection pConncection = tx.getJdbcConnection();
    ConcurrentRequest cr = new ConcurrentRequest(pConncection);
    Connection conn = (Connection)oapagecontext.getApplicationModule(oawebbean).getOADBTransaction().getJdbcConnection();
    ConcurrentRequest cr = new ConcurrentRequest(conn);http://oracleanil.blogspot.com/2009/04/itemqueryvoxml.html
    Thanks
    --Anil
    http://oracleanil.blogspot.com

  • Why is getDBTransaction().createPreparedStatement not recoginzed even after importing ApplicationModuleImpl?

    Hi everyone,
    The code below compiles fine from my ServicesAMImpl class (which extends ApplicationModuleImpl). But, when I move this to a "common" class, the code below is not found even when I import the ApplicationModuleImpl class.
        protected void callStoredProcedure(String statement,
                                           Object[] bindVariables) {
            PreparedStatement preparedStatement = null;
            try {
                // 1. Create a JDBC PreparedStatement.
                preparedStatement =
                        getDBTransaction().createPreparedStatement("begin " +
                                                                   statement +
                                                                   "end; ", 0);
                if (bindVariables != null) {
                    // 2. Loop over values (if any) for the bind variables.
                    for (int i = 0; i < bindVariables.length; i++) {
                        // 3. Set the value of each bind variable in the statement.
                        preparedStatement.setObject(i + 1, bindVariables[i]);
                // 4. Execute the statement.
                preparedStatement.executeUpdate();
            } catch (SQLException e) {
                throw new JboException(e);
            } finally {
                if (preparedStatement != null) {
                    try {
                        // 5. Close the statement.
                        preparedStatement.close();
                    } catch (SQLException e) {
                        System.out.println("Exception in callStoredProcedure(" +
                                           "String statement, " +
                                           "Object[] bindVariables): " + e);
                        e.printStackTrace();
    James

    James,
    This is simple java. The method you have problems with, getDBTransaction, is a method which is implemented in the application module implementation class. When you move the method into a common class you move it outside of the application module and the getDBTransaction is not reachable.
    As only the application module handles transactions it doesn't make sense to move your method outside the application module.
    Timo

  • GetDBTransaction().closeTransaction() should be used to Close connection .?

    Hi all,
    I am writing cutom queries in ADF applications in application module classes.Here Iam using getDBTransaction().closeTransaction();to connect to data base.After using this object does it needed to close the connection explicitly by using this command (getDBTransaction().closeTransaction(); )What happen if we doesnt close the connection explicitly.
    One more thing is we are not using any method of getDBTransaction() to connect to data base.
    Some times iam getting the error "JBO-26030: Failed to lock the record, another user holds the lock" Is it due to not closing the connections properly.
    Please help me .
    Thank you
    Parker

    Make your recordings and then open the QuickTime movie.
    Use the Share menu and choose the email small setting. You'll get an estimated file size in the dialog window.
    Your viewers must have QuickTime 7 installed to view these files.

  • GetDBTransaction is not connected...

    Hi,
    I had an application module called "SampleAppModule" and I deployed it as remote stateful session bean and using Container transaction management described in ejb-jar.xml, then I wrote a sample client simply for calling the SampleAppModuleBean.
    In SampleAppModule I exposed a method pingDatabase which was containing :
    System.out.println(getDBTransaction().isConnected());
    As you might have thought... the sample client called pingDatabase. I had deployed the bean within internal OC4J and Standalone OC4J but the result still same ... getDBTransaction().isConnected() == false
    But when I test the app module using local configuration and through application pool, the result will be true...
    In app module's configuration, I have set the application pool option. Perhaps there are options in Standalone OC4J that I have missed??
    TIA
    Indra

    Actually, I solved the problem without using getDBTransaction function. I've created the java code for the functions/procedures of the database by using JDevelopers own code generator (creates "toplevel" class) and called them in the form class. Even if the procedure that is inside of the DB is changed, it still works well for the program without changing the java code (understood that generated code just manages bindings). The only disadvantage is, if you add new procedures, you have to re-generate the toplevel class. Now, I'm confused with the usage of the getDBTransaction function, given in the example of OTN site :) .

  • Value stored getDBTransaction()..getSession().getUserData().get loss

    Session variables stored using getDBTransaction()..getSession().getUserData().get("GlobalEntityID") are getting lost automatically. Whats happening ? I have deployed my application on oracle Application server 10g . Appl developed on 10.1.3.2. Is it that when the session is idle this is happening? we need to over this . can anybody help
    regards
    Amit

    I'd recommend reading sections:
    --> 28.5 Managing Custom User Specific Information
    --> 28.8 Testing to Ensure Your Application Module is Activation-Safe
    in the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html
    Information in the user data area is not automatically persisted in the state management snapshot. It's your application's responsibility to save it there and reload it on activation as described in the sections above.

  • How to get getDBTransaction() method in applicationmoduleImpl class

    Hi, I am using jdev 11.1.1.5.0 and I want to use getDBTransaction() at application module impl class please suggest.
    Thanks in advance

    getDBTransaction() :-)
    http://docs.oracle.com/cd/E21043_01/apirefs.1111/e10653/oracle/jbo/server/ApplicationModuleImpl.html#getDBTransaction%28%29
    Anil Bajpai wrote:
    Hi, I am using jdev 11.1.1.5.0 and I want to use getDBTransaction() at application module impl class please suggest.
    Thanks in advance

  • Problem with getDBTransaction() / getRootApplicationModule()

    Hi,
    I need to call the function getDBTransaction().
    So i made my class extends ApplicationModuleImpl.
    But when i call getDBTransaction(), it sends me errors...
    I have seen that the errors comes from the function getRootApplicationModule().
    There is the errors when i try to call getRootApplicationModule():
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Le cycle de vie Faces reçoit des exceptions non traitées en phase INVOKE_APPLICATION 5
    javax.el.ELException: //C:/Documents and Settings/AXIN/Application Data/JDeveloper/system11.1.2.0.38.60.17/o.j2ee/drs/Proto1.1/ViewControllerWebApp.war/Configurateur.jsf @478,74 pollListener="#{backingBeanScope.backing_configurateur.initPage}": oracle.jbo.InvalidOwnerException: JBO-25301: Le module d'application Configurateur_286 n'est pas un module racine mais il n'a pas de parent.
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1579)
         at org.apache.myfaces.trinidad.component.UIXPoll.broadcast(UIXPoll.java:98)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:965)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:346)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:204)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:121)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: oracle.jbo.InvalidOwnerException: JBO-25301: Le module d'application Configurateur_286 n'est pas un module racine mais il n'a pas de parent.
         at oracle.jbo.server.ComponentObjectImpl.getRootApplicationModule(ComponentObjectImpl.java:177)
         at proto.view.Configurateur.callStoredProcedure1(Configurateur.java:305)
         at proto.view.Configurateur.questionnaireRowSelection(Configurateur.java:349)
         at proto.view.Configurateur.setFirstRowSelected(Configurateur.java:520)
         at proto.view.Configurateur.MajQuestEtArbo(Configurateur.java:900)
         at proto.view.Configurateur.initPage(Configurateur.java:1038)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
         ... 44 more
    <RegistrationConfigurator> <handleError> ADF_FACES-60096:Exception du serveur pendant PPR, #1
    javax.el.ELException: //C:/Documents and Settings/AXIN/Application Data/JDeveloper/system11.1.2.0.38.60.17/o.j2ee/drs/Proto1.1/ViewControllerWebApp.war/Configurateur.jsf @478,74 pollListener="#{backingBeanScope.backing_configurateur.initPage}": oracle.jbo.InvalidOwnerException: JBO-25301: Le module d'application Configurateur_286 n'est pas un module racine mais il n'a pas de parent.
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1579)
         at org.apache.myfaces.trinidad.component.UIXPoll.broadcast(UIXPoll.java:98)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:965)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:346)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:204)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:121)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: oracle.jbo.InvalidOwnerException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25301
         at oracle.jbo.server.ComponentObjectImpl.getRootApplicationModule(ComponentObjectImpl.java:177)
         at proto.view.Configurateur.callStoredProcedure1(Configurateur.java:305)
         at proto.view.Configurateur.questionnaireRowSelection(Configurateur.java:349)
         at proto.view.Configurateur.setFirstRowSelected(Configurateur.java:520)
         at proto.view.Configurateur.MajQuestEtArbo(Configurateur.java:900)
         at proto.view.Configurateur.initPage(Configurateur.java:1038)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
         ... 44 moreDo i have to change sth in Model.jpx ?
    My model.jpx contains:
      <DesignTime>
        <Attr Name="_jprName" Value="../../../Model.jpr"/>
        <Attr Name="_jbo.TypeMapEntries" Value="OracleApps"/>
        <Attr Name="_NamedConnection" Value="Octal"/>
        <Attr Name="_appModuleNames0" Value="proto.model.module.AppModule"/>
      </DesignTime>Thanx in advance !
    Trigger

    Hi,
    I am trying to call a stored pl/sql procedure packaged in my database...
    For this i generated the class AppModuleImpl (Appmodule.xml -> Java -> pencil -> Generate...)
    public class AppModuleImpl extends ApplicationModuleImpl {
    ...And in my backing bean code (Configurateur.java) i need to call getDBTransaction() before calling the stored procedure...
    For this i extended my class ApplicationModuleImpl (praying god it will work)...
    public class Configurateur extends AppModuleImpl{ ...My AM class property is having:
    <AppModule
      xmlns="http://xmlns.oracle.com/bc4j"
      Name="AppModule"
      Version="11.1.2.60.17"
      ClearCacheOnRollback="true"
      ComponentClass="proto.model.module.AppModuleImpl">
      <DesignTime>
        <Attr Name="_isCodegen" Value="true"/>
      </DesignTime>
      <ViewUsage
    </AppModule>...

  • GetDBTransaction() is not found ??? Help

    Hi,
    I'm using Oracle JDeveloper 10.1.3, and trying to run the functions and procedures by using the interface of the form I've created.
    (Like: Clicking a button on the form and running a specific procedure which takes some fields on the form as parameters.) . However, when I call getDBTransaction function, JDeveloper gives the error "method getDBTransaction() not found " even if I import the DBTransaction library. I run "Database Stored Procedure and ADF Business Components" example on the Oracle OTN site without any problem. I import all of the libraries this example code has into my code, but it still gives the error.
    How can I solve this problem? Is there any other way to run stored procedures/functions by using the form interface?

    Actually, I solved the problem without using getDBTransaction function. I've created the java code for the functions/procedures of the database by using JDevelopers own code generator (creates "toplevel" class) and called them in the form class. Even if the procedure that is inside of the DB is changed, it still works well for the program without changing the java code (understood that generated code just manages bindings). The only disadvantage is, if you add new procedures, you have to re-generate the toplevel class. Now, I'm confused with the usage of the getDBTransaction function, given in the example of OTN site :) .

  • GetDBTransaction method in EntityDefImpl, exists or not?

    According to this document (http://www.oracle.com/technology/products/jdev/tips/muench/mostcommon/index.html), should exist the method getDBTransaction on EntityDefImpl, but it is not there on JDev 10.1.2.
    How can I access the current transaction on a EntityDefImpl subclass then?

    I think that must be a typo. If you look at the top of the table, it states,
    "The EntityDefImpl class is a singleton, shared metadata object for all entity objects of a given type in a single Java VM."
    That means that an EntityDefImpl instance isn't tied to a signle transaction (but rather to all transactions being handled by the VM), so there's no way you could get transactional information off of it (or from a method within it, unless you pass a transactional object in as a parameter).
    If you want to put a method in a class that is shared by all entity object instances of a given type for a given transaction, it should go in an EntityCache subclass, not an EntityDefImpl subclass.
    If you were hoping to override the entity creation process in such a way as to take the current transaction into account, you need to override EntityImpl.create(), not an EntityDefImpl method.
    Hope this helps,
    Avrom

  • GetDBTransaction on EntityDefImpl not found

    The Fusion Developer Guide in Appendix E (specifically in E.2.5.1 Methods You Typically Call on EntityDefImpl) suggests that there is a getDBTransaction() available, but I don't see it in the Javadoc, nor is it available on a subclass using code completion.
    Is the documentation wrong? Is there an alternative way to get the current transactions through the EntityDefImpl?
    Thanks in advance.

    sure, Chris, but how exactly do I log a documentation but with support?
    Here is my use case:
    I am creating a trigger implemented in the middle tier. We have a requirment to save a change log (audit trail) of any changes made to rows in a particular table. So rather than write a DB trigger, I though I would do it at the entity level. When the doDML statement is executed for this particular entity, I also create an instance of the entity for the change log. Much of the data from the change log comes from the main entity row. I was following appendix E and created my own custom class which subclasses EntityDefImpl, wrote a createXXX() method which takes an instance of the main entity from which most of the values come.
    I then tried creating a NameValuePairs instance that I populated with the values from the main entity, then called the createInstance() method on the custom EntityDefIimpl subclass. Here is where I need the transaction object (createInstance(DBTransaction txn, AttributeList al). This approach gave me problems with "Returning Into" and mandatory attributes. So I tried a different approach, which follows:
    public void createChngLogEntryFromSchlrAidYear(SchlrAidYearEOImpl schlrAy, String event, DBTransaction transaction){
    // NameValuePairs nvp = new NameValuePairs();
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.SchlrAidYearId.name(),schlrAy.getSchlrAidYearId());
    // nvp.setAttribute("Event",event);
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AppId.name(),schlrAy.getAppId());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.ExternalName.name(),schlrAy.getExternalName());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.SortName.name(),schlrAy.getSortName());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardCountMaximum.name(),schlrAy.getAwardCountMaximum());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardCountMinimum.name(),schlrAy.getAwardCountMinimum());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardAnnouncedBy.name(),schlrAy.getAwardAnnouncedBy());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardAmountAvailable.name(),schlrAy.getAwardAmountAvailable());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardAmountMinimum.name(),schlrAy.getAwardAmountMinimum());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardAmountMaximum.name(),schlrAy.getAwardAmountMaximum());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.IsActive.name(),schlrAy.getIsActive());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.IsPublicized.name(),schlrAy.getIsPublicized());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardableThroughCsa.name(),schlrAy.getAwardableThroughCsa());
    // nvp.setAttribute(SchlrAidYearEOImpl.AttributesEnum.AwardItemTypeId.name(),schlrAy.getAwardItemTypeId());
    // //this.createInstance(transaction, nvp);
    SchlrAidYearChnLogEOImpl newInstance = (SchlrAidYearChnLogEOImpl)this.createInstance2(transaction, null);
    newInstance.setSchlrAidYearId(schlrAy.getSchlrAidYearId());
    newInstance.setEvent(event);
    newInstance.setAppId(schlrAy.getAppId());
    newInstance.setExternalName(schlrAy.getExternalName());
    newInstance.setSortName(schlrAy.getSortName());
    newInstance.setAwardCountMaximum(schlrAy.getAwardCountMaximum());
    newInstance.setAwardCountMinimum(schlrAy.getAwardCountMinimum());
    newInstance.setAwardAnnouncedBy(schlrAy.getAwardAnnouncedBy());
    newInstance.setAwardAmountAvailable(schlrAy.getAwardAmountAvailable());
    newInstance.setAwardAmountMaximum(schlrAy.getAwardAmountMaximum());
    newInstance.setAwardAmountMinimum(schlrAy.getAwardAmountMinimum());
    newInstance.setIsActive(schlrAy.getIsActive());
    newInstance.setIsPublicized(schlrAy.getIsPublicized());
    newInstance.setAwardableThroughCsa(schlrAy.getAwardableThroughCsa());
    newInstance.setAwardItemTypeId(schlrAy.getAwardItemTypeId());
    {code}
    This worked fine without any errors. Note that the DBTransaction object is passed in from the calling class (the main entity).
    Any other approaches would be welcome.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • About getDBTransaction Method

    Hi
    I am using jdev11.1.1.5.0
    I want to use getDBTransaction() in a simple java file out of model project
    Is it possible to do the same ?
    Thanks.

    could you please.
    Re: How can i add getDBTransaction() in a managedBeam binded to a button?

  • Validation before getDBTransaction().PostChanges

    Hello? my Jdev version is 11.1.2.3.0.
    Can u tell me please how to programmatically raise entity and entity attributes validations before PostChanges command?
    Edited by: user11274766 on 07.11.2012 4:27

    Try calling validate() on the row...
    Timo

  • Getdbtransaction from applicationmodule

    Hi
    I'm trying to call pl/sql procedures from java. I know now how this is done, i have to use getDBTansaction method from the applicationModuleImpl object to get the connection object and so on... my problem now is how to get the applicationModuleImpl object having the applicationModule already? any help?
    other way to help me is to tell how to get the DBTransaction object from Transaction object returned by the getTransaction method of the applicationmodule object.
    thanks in advanced
    Vitor

    How did you solve this?
    Karyn

  • Oracle.jbo.RowCreateException: JBO-25017: Error while creating a new ROW

    I am trying same multi step PO example. I have created a search page and there are 3 other pages for PO Header, PO Line and Review/Submit Page. I am coming on 2nd page(creating Line Item) and when I click on create new item record I am getting this error. Any help will be aprrecaited.
    oracle.jbo.RowCreateException: JBO-25017: Error while creating a new entity row for POLinesEO.
    This is my code for POLineShipFullVORowImpl.java
    protected void create(oracle.jbo.AttributeList nvp)
    POLinesEOImpl lineEO = (POLinesEOImpl)getEntity(0);
    POShipmentEOImpl shipmentEO = (POShipmentEOImpl)getEntity(1);
    try
    // Create Lines EO
    lineEO.create(nvp);
    // Create Shipments EO
    shipmentEO.create(lineEO);
    // Calling this ensures that any personalization default values are
    // properly set since the OAF normally sets this in the super.create(), but
    // since this is not called in this workaround, we need another method
    // to ensure customer defaults are applied.
    // The following method was introduced in OAF internal release 11.5.10J. Since
    // the production release of the ToolBox must be able to run on 11.5.10I, this
    // cannot be enabled.
    // setDefaultValue();
    catch (Exception ex)
    lineEO.revert();
    shipmentEO.revert();
    if (ex instanceof oracle.jbo.JboException)
    oracle.jbo.JboException jboEx = (oracle.jbo.JboException)ex;
    // Developers have to do the mapping on their own becauce of the override.
    jboEx.doEntityToVOMapping(getApplicationModule(), new oracle.jbo.ViewObject[]{getViewObject()});
    throw jboEx;
    throw OAException.wrapperException(ex);
    } // end create()
    Code for PoLinesEOImpl.java
    * Initializes a new purchase order line.
    public void create(AttributeList attributeList)
         // NOTE: header id is automatically set by BC4J because of the
    // composition association.
    super.create(attributeList);
    OADBTransaction transaction = (OADBTransaction)getOADBTransaction();
    // DEFAULT: line id
    Number lineId = transaction.getSequenceValue("FWK_TBX_PO_LINES_S");
    setLineId(lineId);
    // DEFAULT: Line number
    POHeaderEOImpl headerEO = getPOHeaderEO();
    Number newLineNum = headerEO.getNextLineNum();
    setLineNumber(newLineNum);
    } // end create()
    * Sets <code>value</code> as the attribute value for ShipmentNumber
    * Business Rules
    * Required; cannot be null
    * Cannot be updated on a committed line
    * Must be unique for this purchase order
    * Must be >= 1
    public void setLineNumber(Number value)
    if (value != null)
    // Verify value is > 0
    if (value.compareTo(0) <= 0)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "LineNumber", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "DEBUG -- add message"); // Message name
    // To verify uniqueness, start by checking the entity cache.
    com.sun.java.util.collections.Iterator lineIterator =
    getEntityDef().getAllEntityInstancesIterator(getDBTransaction());
    Number lineId = getLineId();
    Number headerId = getHeaderId();
    while ( lineIterator.hasNext() )
    POLinesEOImpl cachedLine =
    (POLinesEOImpl)lineIterator.next();
    Number cachedLineNum = cachedLine.getLineNumber();
    Number cachedLineId = cachedLine.getLineId();
    Number cachedHeaderId = cachedLine.getHeaderId();
    if ((cachedLineNum != null) &&
    (cachedLineNum.compareTo(value) == 0) &&
    (cachedLineId.compareTo(lineId) != 0) && // Exclude this line
    (cachedHeaderId.compareTo(headerId) == 0))
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "LineNumber", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "DEBUG -- add message"); // Message name
    // Didn't find a duplicate in the entity cache so now we check the database.
    // Note: don't bother with this if the header is in a NEW state since that
    // means we won't have any lines in the database yet.
    POHeaderEOImpl headerEO = getPOHeaderEO();
    if (headerEO.getEntityState() != STATUS_NEW)
    PurchaseEntityExpert poExpert =
    POHeaderEOImpl.getPurchaseEntityExpert(getOADBTransaction());
    PoLineNumVVOImpl valLineNumVO =
    (PoLineNumVVOImpl)poExpert.findValidationViewObject("PoLineNumVVO1");
    valLineNumVO.initQuery(headerId, value);
    // We're doing an existence check; shouldn't have any rows.
    if (valLineNumVO.hasNext())
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "LineNumber", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "DEBUG -- add message"); // Message name
    // If this is the largest line number for this order, this will store it for
    // reference when creating subsequent lines.
    headerEO.resetLineNum(value);
    setAttributeInternal(LINENUMBER, value);
    } // end setLineNumber()
    Edited by: user9941374 on Mar 15, 2012 3:16 PM

    Hi Frank,
    As per the steps mentioned in the following link :
    http://www-apps.us.oracle.com:1100/fwk/jdev/doc/devguide/bus/bus_java.htm#tl
    I have created the required entity objects and view objects.
    I have an entity JobsDEO which is based on a view per_jobs_vl which is itself based on 2 tables,per_jobs_f and per_jobs_tl,wherein _tl is the translation table.
    The entity for _tl table is JobTranslationEO and has no VO associated with it.Its the JobsVO,based on JobsDEO,that has to handle any interactions with this entity too.
    JOBSDEO has a property set up for HCM_DBSEQUENCE,which makes it read the value of job_id from the sequence per_jobs_s.
    Now,when I try to insert into the JobsVO,based on JobsDEO,it gives me the above mentioned error.
    One more thing is that the error does'nt occur when we commit a row,its just when we click the "+" button in the AM Tester that we get this error.
    Please advice.

Maybe you are looking for