Use of Entity object

Hi Everyone,
I am totally new to using JDeveloper and the ADF Framework.The following is my Environment setup :-
1] Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
2] JDeveloper 9.0.5.2
Need ur help in answering my following queries :-
1] Is it possible to access the Entity object directly from a calling class and execute the INSERT, UPDATE and DELETE operations ? In either of the cases, please let me know how it can be done, preferably with some sample code.
2] Can I used the View object without Entity object for retrieving data from the database ? Please help me with some sample code if possible.
Thanks in advance.

Hi,
Detail Rule, copy attribute value form master.
In DetailEOImpl:
protected void create(AttributeList attributeList)
setAttribute(MASTERFIELD,this.getMaster().getMasterField());
super.create(attributeList);
Master rule, set flag to 0 if no details else set to 1.
In the MasterEOImpl added method to check if detail row exists based on Row Iterator => no db retrieval?
This method also sets the flag accordingly:
protected void checkHasOtherDetails()
oracle.jbo.RowIterator ri = this.getRetrieveFromdetail();
ri.last();
// last() must be called else hasNext() returns true even on last delete ???
Number hasDetails = Constants.NUMBER_NO; // = 1
if (ri.hasNext() || ri.hasPrevious())
hasDetails = Constants.NUMBER_YES; // = 0
if (!getHasDetailsFlag().equals(hasDetails)) {
this.setHasDetailsFlag(hasDetails);
I call this method in the remove method of the detailEOImpl:
public void remove()
this.getRetrieeFromMaster().checkHasOtherDetails();
super.remove();
To set the flag I added follwoing code in the create method of the DetailEOImpl:
protected void create(AttributeList attributeList)
setAttribute(MASTERFIELD,this.getMaster().getMasterField());
**** ADDED ***
Number masterHasDetailsFlag = getRetrieveFromMaster().getHasDetailsFlag();
if (!masterHasDetailsFlag.equals(Constants.NUMBER_YES)) {
getRetrieveFromMaster().setHasDetailsFlag(Constants.NUMBER_YES));
super.create(attributeList);
One more question:
Is there a danger of calling last() on row iterators in create/update/remove methods of *Impl files?
=> current row changed => any effect on display in JPanel
Thanks
Frederic
PS All variable/method/class names have been manually renamed in this code so some small syntax problems may exist.

Similar Messages

  • Error while saving data using two entity objects (EO)

    Hi All,
    i am using two entity objects for saving the date in two different tables.
    on my page i am having two tables and two save buttons for saving the data in the respective tables.
    if i am not entering any data on the first table and putting valid data on the second table and click on the save button.
    it is going into error saying "Null Pointer Exception"..
    i am using getTransaction.commit() in my AM.
    so it is trying to save all the data in both the tables.
    i want to commit data of the respective table for which the save button is clicked.
    Waiting for ur reply

    Hi,
    i am using the following code for saving the data in the AM
    // TO SAVE THE JOB ASSIGNMENT DETAILS
    public void saveJobAssignmentDetails(String projectId)
    EmpAssignmentVOImpl empAssignVO = getEmpAssignmentVO1();
    getTransaction().commit(); // Line where i am getting the error
    rowNumberCountJobAssign = 0; // IN JOB ASSIGNMENT
    // EXECUTING THE DISPLAY FUNCTION AGAIN SO TAHT ALL SAVED FIELD ARE READONLY AS REQUIRED
    displayJobAssign(projectId);
    if(empAssignVO.getRowCount() != 0)
    throw new OAException("Job assignment details have been saved successfully. ",OAException.CONFIRMATION);
    Stack trace :
    oracle.apps.fnd.framework.OAException: oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "BEGIN INSERT INTO pa_job_bill_rate_overrides(START_DATE_ACTIVE,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CREATED_BY,LAST_UPDATE_LOGIN,BILL_RATE_UNIT,PROJECT_ID,RECORD_VERSION_NUMBER,JOB_BILL_RATE_OVERRIDE_ID,RATE_CURRENCY_CODE) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11) RETURNING JOB_BILL_RATE_OVERRIDE_ID, JOB_ID, START_DATE_ACTIVE, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, RATE, BILL_RATE_UNIT, PROJECT_ID, TASK_ID, END_DATE_ACTIVE, RECORD_VERSION_NUMBER, RATE_CURRENCY_CODE, DISCOUNT_PERCENTAGE, RATE_DISC_REASON_CODE INTO :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28; END;".
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:972)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:210)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.webui.jobBillRateAndAssignmentCO.processFormRequest(jobBillRateAndAssignmentCO.java:357)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("PA"."PA_JOB_BILL_RATE_OVERRIDES"."JOB_ID")
    ORA-06512: at line 1
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1983)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1141)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2154)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2036)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2880)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:622)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:698)
         at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:371)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5108)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.schema.server.JobBillRateEOImpl.doDML(JobBillRateEOImpl.java:124)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4015)
         at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(OAEntityImpl.java:1676)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2694)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2540)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1783)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:1976)
         at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(OADBTransactionImpl.java:680)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.server.jobBillRateAndAssignmentAMImpl.saveJobAssignmentDetails(jobBillRateAndAssignmentAMImpl.java:772)
         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:324)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:189)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.webui.jobBillRateAndAssignmentCO.processFormRequest(jobBillRateAndAssignmentCO.java:357)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("PA"."PA_JOB_BILL_RATE_OVERRIDES"."JOB_ID")
    ORA-06512: at line 1
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1983)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1141)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2154)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2036)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2880)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:622)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:698)
         at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:371)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5108)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.schema.server.JobBillRateEOImpl.doDML(JobBillRateEOImpl.java:124)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4015)
         at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(OAEntityImpl.java:1676)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2694)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2540)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1783)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:1976)
         at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(OADBTransactionImpl.java:680)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.server.jobBillRateAndAssignmentAMImpl.saveJobAssignmentDetails(jobBillRateAndAssignmentAMImpl.java:772)
         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:324)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:189)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721)
         at tcsl.oracle.apps.pa.jobBillRateAndAssignment.webui.jobBillRateAndAssignmentCO.processFormRequest(jobBillRateAndAssignmentCO.java:357)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)

  • Problem with using multiple Entity Objects in a view Object.

    Hi
    Thank you for reading my post
    I have create 3 Business components for 3 of my database tables and now
    I must add 3 tables in a View object so i used Jdeveloper Wizard to create the View Object.
    -I Add Entity Objects which are business components to this view (In Step 2 of the Create Vview Object wizard).
    -In step 3 that I add Attributes all my attributes are marked as Transient
    Can some one explain why it happens?
    I need one of those tables to be updateable and two other tables are not updateable.
    What should should i do to achieve this?
    I should say that tables does not have any database relation (Foreign Key I Mean).
    Thanks.

    Hi user505214
    When you created your VO, on selecting the second EO, you'll note at the bottom of the same page on the wizard/editor, checkboxes for updatable or by reference. By default reference is checked and this will make your second EO's attributes transient.
    In the JDeveloper Developer's Guide for 4GL/Forms programmers, the following sections outline the difference between updatable or by reference:
    7.5 Including Reference Entities in Join View Objects
    27.9 Creating a View Object with Multiple Updatable Entities
    Make sure to read 27.9 if updatable is what you want as it indicates you may need to add some additional code.
    Hope this helps.
    CM.

  • Using JPA Entity-Objects defined in other EJB-Development Component

    Hello Community,
    I'm working on a Java-Application on NW CE 7.1, using JEE5 Beans in the Business-Logic-Layer and WebDynpro/Java in the UI-Layer.
    I designed a Bean for working with data, stored in a database-table of the system-database.
    For that addtionally i created a class, representing the Entity-Object, in the same Development-Component of Type EJB 3.0.
    It looks like this:
    @NamedQueries ({
         @NamedQuery (name="findAllSdCust", query="SELECT c from SdCust c ORDER BY c.kdnr"),
         @NamedQuery (name="findSdCustByKdnr", query="SELECT c from SdCust c WHERE c.kdnr = :kdnr"),
         @NamedQuery (name="findSdCustByIlnnr", query="SELECT c from SdCust c WHERE c.ilnnr = :ilnnr")
    @Entity
    @Table(name="ZKALL_SD_CUST")
    public class SdCust implements Serializable {
         @Id
         @TableGenerator (name="idGenerator", table="ZKALL_ID_GEN", pkColumnName="GEN_KEY", valueColumnName="GEN_VALUE", initialValue=100)
         @GeneratedValue (strategy=GenerationType.TABLE, generator="idGenerator")
         private long id;
         private String name;
         private String lname;
         private String kdnr;
         private String ilnnr;
         private long connid;
         private long cnt;
         @Version
         private long version;
          Constructor, Getter and Setter methods follow here
    The corresponding bean looks like this
    @Stateless(name="SdCustBean")
    public class SdCustBean implements SdCustLocal {
         @PersistenceContext (unitName="xyz")
         private EntityManager em;
         public SdCust getSdCustByKdnr (String kdnr)
              SdCust result = new SdCust();
              // List<Manufacturer> resultList = new ArrayList<Manufacturer>();
              Query  myQuery = em.createNamedQuery("findSdCustByKdnr");
              myQuery.setParameter("kdnr", kdnr);
              result = (SdCust) myQuery.getSingleResult();
              return result;
         public void setEM (EntityManager iem)
              em = iem;
           // other methods .....
    After that i created a new Development-Component of Enterprise Application-Type and added above DC to this EAR-DC. I also supplied the nessecary descriptor-files/Enries in EJB-DC and EAR-DC.
    When now using this bean from WebDynpro with the Web-Dypro EJB-Model-Import everything works fine.
    The bean returns the desired object(s).
    But now i created a new DC of type EBJ 3.0
    This DC contains a Message Driven Bean. That MDB is a Job-Bean which i want to schedule. That  Bean uses JRA to connect to an SAP-Abap-System to read some Data and should use JPA to insert/upate/delete the read data in the Database. This should work as a simple replication for my application.
    I assigned that EJB-DC containing the MDB to a new EAR-DC together with job-definition-xml and the neccessary entries in deployment-descriptors.
    After deploying i see the corresponding job-defition in the NW scheduler using the administrator-views.
    I'm also able to schedule the job and it executes fine. Connecting to SAP-Abap System also works fine using JRA.
    But JPA does not work!!!!!
    I created an dependency from my EAR-DC containing the Job EJB-DC and to the EJB-DC containing the Entity-Class.
    I tried three diferent things to get i running, but all of them failed.
    1.)
    The part  looks like:
    public class MasterDataReplicateJobBean extends MDBJobImplementation implements MessageListener
      @EJB SdCustBean mybean;
       public void onJob(JobContext ctx) throws Exception {
            SdCust sdCust = mybean.getSdCustByKdnr (mykdnr);
    Compiles fine. But this fails because the Data is stored in the system-database. The exception says, that i have to use a datasource which supports 2-Phase commit. I know, that i could possibly solve this problem by annotation the Method getSdCustByKdnr with the Annotation for the Transaction-Manager to use REQUIRES_NEW Transaction. But i dont want to generally annotate my methods this way.
    2.)
    This part looks like this
    public class MasterDataReplicateJobBean extends MDBJobImplementation implements MessageListener
    @PersistenceContext (unitName="xyz")
    private EntityManager em;
       public void onJob(JobContext ctx) throws Exception {
         SdCust cust = new SdCust();
         Query  myQuery = em.createQuery("SELECT c from SdCust c WHERE c.kdnr = :kdnr");
         myQuery.setParameter("kdnr", dbkdnr);
         cust = (SdCust) myQuery.getSingleResult();
    This also results in a runtime-exception because the entity-Manager cant resolve SdCust from the Query as an Object. The Exception is:
    java.lang.IllegalArgumentException: line 1: Abstract Schema Type 'SdCust' doesn't exist
    SELECT c from SdCust c WHERE c.kdnr = :kdnr
    3.) and last try so far:
    public class MasterDataReplicateJobBean extends MDBJobImplementation implements MessageListener
    @PersistenceContext (unitName="xyz")
    private EntityManager em;
       public void onJob(JobContext ctx) throws Exception {
         SdCustBean custBean = new SdCustBean();
         custBean.setEM(em);
         SdCust cust = custBean.getSdCustByKdnr(kdnr);
    In this example i use the Bean from the beginning not as a bean itself but as a normal class. that class has an addtional Method setEM to set the Entity-Manager (which is injected when using the class as a bean)
    In that way i got the exception, that the named Query "findSdCustByKdnr" cannot be found by the entity-manager.
    It seems to me, that i can access the class, but that all annotations belonging to JPA for that class are not recognized.
    Does anybody can give me a hint to solve this problem? Did i forgot something important?
    best regards
    matthias hayk
    Edited by: Matthias Hayk on Feb 5, 2009 9:38 AM

    I was already on wright trace.
    My class "SdCust" was not recognized by the Entity-Manager as an Entity-Class.
    This relies on the storage of the entity-class and where the Entity-Manager looks for entity-classes.
    By default it seems to look for all classes in the same jar file. thats the reason why everything works fine when the using bean and the entity-class are in the same project.
    In my last case, the using bean is in another  development-component and so also in anohter jar file. in this case the entity-manager must be told where to find entity-classes.
    this is done in the persistence.xml file.
    i added the line
    <jar-file>xxx.yyy.com~mdata_beans.jar</jar-file>
    underneath the <persistence-unit>-tag.
    This works.
    regards
    Matthias Hayk

  • Entity Object validation for "Date" type

    I am trying to use the Entity Object validation for a Date field type, it is a required field.
    I am using the format: MM/dd/yy HH:mm:ss
    It is a simple validation where the date value must be less than or equal to the current date/time.
    I tried using "Query Result" validation where the date is LESS THAN the query SELECT SYSDATE FROM dual.
    This throws an error:
    JBO-27011: Attribute set with value 2006-07-09 14:05:53.0 for LksrSurveyDte in LCFSReportService.LeakDetailView1 failed.
    I have be unable to find help on validating dates using validation for an Entity Object and need some help.
    Thanks in advance.

    In your case you can implement a service method in the VO to check if any other reservation overlaps with the new one (which is not inserted in the db).
    I would use a an other VO (e.g. VODateCheck) for this. This VO has it's query build to check if a given roomid and a given startdate(time?) overlaps any other record for the roomid
    select * from ReservationRoom where RoomId=:bindRoomId and ReservationEnd>=:bindReservationStartIf this query returns one or more rows you have an overlapping in the schedule and throw an error.
    You call this VODateCheck from your service method in the other module before inserting the record. Set the bind variables in the VODateCheck and execute the query.
    Timo

  • Entity Object Classes Example

    Hi,
    Does anyone have an example on how to use Entity Object Class for a given Entity Object (i.e. a table). I was looking for an example that shows usage of a DML operation (say for e.g. insert) using this Entity Object Class.
    I did google, and searched this forum, but could not find an example.
    Please help, Thanks you,
    J
    Edited by: 843190 on Apr 5, 2011 2:13 PM

    Thank you Shay.
    I was searching just a little bit off, and moreover I could not see any end to end example, then. Thanks as always for your guidance.
    I ended up doing the following for inserting a new row to a table using the entity object class as follows:
    EntityDefImpl wmDoc = DocumentImpl.getDefinitionObject();
    DocumentImpl newDoc;
    newDoc = (DocumentImpl)wmDoc.createInstance2(((ApplicationModuleImpl)am).getDBTransaction(), null);
    newDoc.setBlah(blah);
    newDoc.setBlooh(blooh);
    try
    {    ((ApplicationModuleImpl)am).getDBTransaction().commit(); 
    } catch (JboException ex) {   
    ((ApplicationModuleImpl)am).getDBTransaction().rollback();
    throw ex;
    Configuration.releaseRootApplicationModule(am, false);

  • Using a Custom Object to allow an Entity to link to itself

    Hey folks,
    Have a feeling the answer to this is No, but have to ask anyway.
    Is there any way that anyone is aware of to use a Custom Object to link an Entity to itself? For example... We have a CO (Custom Object) which is linked to Service Request. I want to link this CO to Service Request again, allowing one Service Request to be linked to another Service Request via the CO. I can obviously link Service Request to the CO, but the second link doesn't seem likely.
    Cheers,
    Mark

    You can link multiple Service Requests to a single Custom Object (1-3) very easliy. Just expose SRs under related items on the Custom Object and adjust Access Profiles appropriately. Alternately, you can add Custom Objects to related items on the Service Request page layout so SRs can be linked to multiple COs.
    In the end, you can end up with one CO linked to multiple SRs. This should give you what you are looking for - there may be more elaborate solutions involving multiple advanced custom objects.
    The key, of course, is how you need this data to be viewed or reported on. You'll need to assess this solution to see if the output is what you require.

  • ADF: use of view link Accessor in Entity Object = always null?

    Hi,
    JClient 9.0.5.2, adf model.
    I would like to use the view link accessor method in the master EO to retrieve detail EO values and the view link accessor method in the detail EO to retrieve master EO values.
    Detail Rule:
    In the detail EO an attribute is derived from an attribute of the master EO: detail attribute = master attribute.
    Master Rule:
    In the master EO an attribute is derived from the detail EO: master atribute set to 0 if detail EO exist else set to 0.
    Tables:
    Table Master => MasterEO => MasterVO
    - masterPK (not updateable)
    - masterField (not updateable)
    - hasDetailsFlag
    Table Detail => DetailEO => DetailVO
    - detailPK (not updateable)
    - masterPK => foreign key (not updateable)
    - masterField (query only)
    MasterDetailLink based on foreign key.
    In link wizard I asked for the generation of following accessors in the source & destination Entity Objects:
    In DetailEO accessor name: RetrieveFromMaster
    In MasterEO accessor name: RetrieveFromDetail
    In the DetailEO, I asked for the generation of the DetailEOImpl file, accessors and create method.
    As wriiten in the file, before the create method:
    ** Add attribute defaulting logic in this method. **
    I tought this is the place to retrieve the master attribute:
    The code:
    MasterVORowImpl masterVO = getRetrieveFromMaster();
    if (masterVO == null)
    System.out.println("MasterVORowImpl masterVO create NNNNNNNNNNNUUUUUUUULLLLLLLLLL");
    The masterVO is always null?
    I suppose I didn't understand something, my guest is that ViewObjects may not be used for default logic?
    I know how to implement those rules in the database with triggers.
    I think that the data I need for implementing those rules exist somewhere at the ADF level so retrieving the data from the db is not necessary?
    Could somebody give some clues?
    I didn't find a similar example in the Business Rules in BC4J document.
    Your help will be appreciated
    Frederic

    Hi,
    Detail Rule, copy attribute value form master.
    In DetailEOImpl:
    protected void create(AttributeList attributeList)
    setAttribute(MASTERFIELD,this.getMaster().getMasterField());
    super.create(attributeList);
    Master rule, set flag to 0 if no details else set to 1.
    In the MasterEOImpl added method to check if detail row exists based on Row Iterator => no db retrieval?
    This method also sets the flag accordingly:
    protected void checkHasOtherDetails()
    oracle.jbo.RowIterator ri = this.getRetrieveFromdetail();
    ri.last();
    // last() must be called else hasNext() returns true even on last delete ???
    Number hasDetails = Constants.NUMBER_NO; // = 1
    if (ri.hasNext() || ri.hasPrevious())
    hasDetails = Constants.NUMBER_YES; // = 0
    if (!getHasDetailsFlag().equals(hasDetails)) {
    this.setHasDetailsFlag(hasDetails);
    I call this method in the remove method of the detailEOImpl:
    public void remove()
    this.getRetrieeFromMaster().checkHasOtherDetails();
    super.remove();
    To set the flag I added follwoing code in the create method of the DetailEOImpl:
    protected void create(AttributeList attributeList)
    setAttribute(MASTERFIELD,this.getMaster().getMasterField());
    **** ADDED ***
    Number masterHasDetailsFlag = getRetrieveFromMaster().getHasDetailsFlag();
    if (!masterHasDetailsFlag.equals(Constants.NUMBER_YES)) {
    getRetrieveFromMaster().setHasDetailsFlag(Constants.NUMBER_YES));
    super.create(attributeList);
    One more question:
    Is there a danger of calling last() on row iterators in create/update/remove methods of *Impl files?
    => current row changed => any effect on display in JPanel
    Thanks
    Frederic
    PS All variable/method/class names have been manually renamed in this code so some small syntax problems may exist.

  • Problem to give default value in entity object using query

    hi,
    i have one entity object and i want to set default value of attribute like division which is based on employee code.
    entity object based on table leavedetail and using refrence table employee_hdr(empcode ,division).
    so how can i set default value of division attribute which is based on empcode attribute using SQL

    well,
    yes user, fetish nailed correctly.
    make some viewlink.
    something like says as example.
    department vo
    employee vo
    make viewlinks between those vo's
    important thing: exposed then source and destination accesor.
    use groovy :
    go to employee vo - create Department name field ( as transiest)
    use this statement default value expersion type.
    DepartmentView1.DepartmentName
    it will get the value. check over.
    so this example well suits to your scenario.
    i hope this will helps you.
    well create is an video. to get the value using groovy.
    http://www.youtube.com/watch?v=mpHV4x89a_A
    Edited by: ADF7 on Apr 14, 2012 5:46 AM

  • Setting permissions at entity object level using JAAS and LDAP

    Hi,
    I am using ldap-based provider for authorizaton. Every thing works fine. Authorization works fine based on the roles created in web.xml file.
    Could you please let me know how I can define permissions at entity object level when using ldap based provider.
    Following line is the permission created for an entity object (SpcStrBdgt) when using XML-based provider.
    <permission>
         <class>oracle.jbo.server.security.jazn.JboJAZNEntityPermission</class>                    <name>model.SpcStrBdgt/READONLY</name>
    </permission>
    Above is defined in jazn-data.xml file.How can I define the same thing when using ldap-based provider?
    Thanks,
    Seatre

    Hi,
    There is an enhancement request Bug2692994 for this feature.
    Thanks,
    Yvonne

  • Unable to create Entity objects for tables in TimesTen database using ADF

    Hi,
    I am not able to create Entity and View objects for tables in TimesTen database using ADF. I have installed TimesTen client on my machine.
    I have created a database connection by using connection type as "Generic JDBC" and giving driver class and JDBC URL. I am attaching screen shot of the same.
    I am right clicking on Model project and selecting New option after that I am selecting ADF Business components and in it I am selecting Business components from tables and there I am querying for tables.I am getting list of tables and when I am trying to create a Entity object from the table after clicking finish Jdev is closing by itself giving an error.
    Can anyone please help me how to create Entity objects for tables using TimesTen as database.I might be missing some jars or the way I am creating connection might be wrong or any plugins required to connect to TimesTen.

    What is the actual error being given by Jdev? Are you sure that the JDBC connection is using the TimesTen JDBC driver JAR and not some other JDBC driver or the Generic JDBC/ODBC bridge?
    Is ADF even supported with TimesTen?
    Chris

  • How to create entity object (Business Component) using service interface

    Hi,
    I have tried to create one entity object (ADF Business Component) in JDeveloper 11g using service interface option instead of database schema but getting Failed to read service WSDL URL: http://....?wsdl message.
    I have tried with axis default service Admin & Version wsdl and got same error message.
    Regards,
    Devang

    Hi,
    +"Oracle ADF Business Components application modules offer built-in support for web services and for publishing rows of view object data as service data objects (SDOs). This means that you can use an application module both as a local component and as a remotely accessible service, thereby using the same component to support interactive web user interfaces and web service clients. Entity objects that you create in your local Business Components project can utilize SDOs that the service-enabled application module exposes on its service interface."+
    This means that you don't use Axis services but ADF Business Components Services. I am not sure this functionality made it in Boxer, but surely will in the next
    Frank

  • How to intercept update on entity object using bc4j

    Hi all,
    I need to intercept a user from updating a particular entity object and create a new entity instead. I have a particular row in a database table that has a primary key with special meaning. If a user attempts to update this row, I want to automatically create a new row in the table with the information they entered and leave the original row unmodified. Any suggestions on how to do this at the entity layer?
    Thanks
    Mike

    Hi Sung,
    I've created 2 Entity Objects, named TestEo and OtherEo. The logic I've included is as follows: Before posting data for TestEo to the database (thus as part of the prepareForDML), I create a new instance of OtherEo, using the createBlankInstance method exposed on OtherEoDefImpl.
    However, the instance thus created ends up in a STATUS_UNMODIFIED, regardless of locking mode (I've managed to eliminate the locking mode as an issue).
    Could you give me an idea of where I'm going wrong? I've attached the prepareForDML() (with diagnostic msgs) and createBlankInstance() methods below.
    TestEoImpl.prepareForDML()
    protected void prepareForDML(int p0, TransactionEvent p1)
    switch (this.getDBTransaction().getLockingMode())
    case DBTransaction.LOCK_OPTIMISTIC:
    System.out.println("Locking mode: LOCK_OPTIMISTIC");
    break;
    case DBTransaction.LOCK_PESSIMISTIC:
    System.out.println("Locking mode: LOCK_PESSIMISTIC");
    break;
    // TODO: Override this oracle.jbo.server.EntityImpl method
    super.prepareForDML(p0, p1);
    OtherEoDefImpl otherEoDef = (OtherEoDefImpl) EntityDefImpl.findDefObject(
    "testapp.OtherEo");
    System.out.println("Entity Class: " + this.getClass().getName());
    switch (this.getEntityState())
    case EntityImpl.STATUS_DEAD:
    System.out.println("Entity State: STATUS_DEAD");
    break;
    case EntityImpl.STATUS_DELETED:
    System.out.println("Entity State: STATUS_DELETED");
    break;
    case EntityImpl.STATUS_INITIALIZED:
    System.out.println("Entity State: STATUS_INITIALIZED");
    break;
    case EntityImpl.STATUS_MODIFIED:
    System.out.println("Entity State: STATUS_MODIFIED");
    break;
    case EntityImpl.STATUS_NEW:
    System.out.println("Entity State: STATUS_NEW");
    break;
    case EntityImpl.STATUS_UNMODIFIED:
    System.out.println("Entity State: STATUS_UNMODIFIED");
    break;
    EntityImpl otherEo = otherEoDef.createBlankInstance(getDBTransaction());
    System.out.println("Entity Class: " + otherEo.getClass().getName());
    int state = otherEo.getEntityState();
    switch (state)
    case EntityImpl.STATUS_DEAD:
    System.out.println("Entity State: STATUS_DEAD - " + state);
    break;
    case EntityImpl.STATUS_DELETED:
    System.out.println("Entity State: STATUS_DELETED - " + state);
    break;
    case EntityImpl.STATUS_INITIALIZED:
    System.out.println("Entity State: STATUS_INITIALIZED - " + state);
    break;
    case EntityImpl.STATUS_MODIFIED:
    System.out.println("Entity State: STATUS_MODIFIED - " + state);
    break;
    case EntityImpl.STATUS_NEW:
    System.out.println("Entity State: STATUS_NEW - " + state);
    break;
    case EntityImpl.STATUS_UNMODIFIED:
    System.out.println("Entity State: STATUS_UNMODIFIED - " + state);
    break;
    OtherEoDefImpl.createBlankInstance()
    public EntityImpl createBlankInstance(DBTransaction p0)
    // TODO: Override this oracle.jbo.server.EntityDefImpl method
    return super.createBlankInstance(p0);
    Output - Test 1
    Locking mode: LOCK_OPTIMISTIC
    Entity Class: testapp.TestEoImpl
    Entity State: STATUS_NEW
    Entity Class: testapp.OtherEoImpl
    Entity State: STATUS_UNMODIFIED - 1
    Output - Test 2
    Locking mode: LOCK_PESSIMISTIC
    Entity Class: testapp.TestEoImpl
    Entity State: STATUS_NEW
    Entity Class: testapp.OtherEoImpl
    Entity State: STATUS_UNMODIFIED - 1

  • How can we create an entity object using multiple tables?

    Hi All,
    I'm a newbie to OAF.
    I'm trying to create a simple page using OAF.
    While creating Entity object, there is an option to add the database objects from which we can create our Entity Object.
    There we can enter only one database object.
    If suppose I need to create a Entity object by using mutiple data base objects, how can I add other database objects?
    Is there any option for multiple selection of database objects there?
    Thanks in Advance

    User,
    a). You should use the [url http://forums.oracle.com/forums/forum.jspa?forumID=210]OA Framework Forum for this question.
    b). Entity objects always correspond to a single table. I think you want to create a View object instead.
    c). Really, you want to be using the OA Framework forum.
    John

  • Can I use subtype/supertype Entity Object with JHeadstart ?

    Hi,
    I am using Generalization on our entity object design, i,e : Employee(SuperType), Hourly_Employee(SubType), SalariedEmployee(SubType), Consoltant(SubType). The attributes attached below.
    All SubTypes will EXTEND the supertype : Employee.
    The questions are :
    Can JHeadstart handle the generalized entity objects ?
    How can the UI look like with JHeadstart ?
    Thank you for your help,
    Krist
    Supertype : Employee
    Employee_Number
    Employee_Name
    Address
    Employee_Type
    Date_Hired
    SubType : Hourly_Employee
    Hourly_Rate
    SubType : Salaried_Employee
    Annual_Salary
    Stock_Options
    SubType : CONSULTANT
    Contract_Number
    Billing_Rate

    Krist,
    If I understand you correctly you want to have a number of View Object attributes in a page to be accessible through 'subtabs', and want the correct subtab to be shown when the 'discriminator' field is changed. I am sorry for the confusion, I got thrown off track with all the super-subtype Entity details, but in the UI you are only dealing with ViewObject (usages), and not Entity Objects.
    Anyway, we can not generate 'subtabs'. There is a feature on our 'Enhancement list' to make the Regions have a 'stacked' property, which I think would come pretty close to what you need: you could group ViewObject Atributes together in Regions, and 'stacked' Regions would be generated as tab pages. We have not implemented this feature yet, and even if we had, you would have to change it post-gen because in your case, you would not want the end user to be able to 'switch tabs', but only a change of the 'discrimitator' field should do that.
    We have shipped some templates, though, for creating subtabs for child groups. Perhaps you could take a look if some of that code could be useable for your.
    I would suggest the following approach:
    1.) In the application structure file, create 'Regions' for all subtypes, and in the BC4J Property Editor, assign the 'subtype' attributes to the corresponding Region.
    2.) Regenerate the page. Now you should have a separate 'header' element for each subtype, containing the appropriate attributes.
    3.) Now you will need to transform those 'headers' to 'subtype tabs'. You could do that by borrowing code from our 'tabbed child' templates, or, alternatively, you could use a similar, Javascript-based technique that we use for switching between Quick Search and Advanced Search.
    4.) Finally, you should device a mechanism to change the active tab when changing the 'discriminator' column in the area above the tabs, with the supertype fields.
    Hope this helps,
    Peter Ebell
    JHeadstart Team

Maybe you are looking for

  • 0x803d0013 Error occured sending encryption status (A fault was received from the remote endpoint)

    Alright, I am stumped. I have looked at nearly every article on this error here at Technet and other sites: An error occurred while sending encryption status data. Error code: 0x803d0013  Details: A message containing a fault was received from the re

  • Error -50 in Imovie 10.0

    I've just started using iMovie version 10, I'm trying to share my movie to file, and get a error -50. The movie only exports the first 20 seconds. Help!

  • How do I establish serial communicat​ion using LabView to two stepper motors using a motor controller​?

    I currently use an off the shelf motor controller to run my two stepper motors. It already has integrated a firmware software that sends commands to operate each motor. I would like to create an interface where I can send these commands using LabView

  • Lockbox un-processed

    Hello All, Our company is processing Customer payments using lockbox file since 5 years. Our current matching criteria is by Reference number. Our situation 1) We have a Customer invoice and we have received customer payment where reference matched 2

  • Getting component name

    Guys, I want to find the component names of my dynamic table ASSIGN COMPONENT  sy-index          OF STRUCTURE <wa_table> TO <dyn_field>. I know there are couple of threads but they are confusing, I tried using one of the method ref_table_des ?= cl_ab