Entity with nested entities, create method generated incorrectly

For the sake of this question, assume I have two entities: Header, and LineItem.  The Header has 0..n LineItems.  I've modeled this in the CAS by creating two entities, with a nested relationship between teh two.  Tables were created correctly, everything looks fine.  I then created an Application Service, which uses the Header an LineItem entities.  I created CRUD methods for the Header object; when selecting the types to be included as part of the create method, I selected Header details, as well as the list of LineItem's.
The generated create method (the _R version), however, does not have the correct method signature.  It looks like this:
public xxx..Header_R createHeader_R(java.lang.String[] lineItems) throws  ...
Why is lineItems declared as String[] instead of LineItem[]?  All objects have been marked as remote enabled, so that's not the issue.  Is this a bug, or a feature?
The other CRUD methods only expose the Header, so I could exclude the LineItem from the create, and just perform an update after the create, but I'd rather not have to create objects in two steps.
Anyone else run into this situation?

Hello Ken!
CRUD operations usually belong to the Entity Services that are generated for the business objects you modelled.
Based on these Entity Services you can implement custom Application Services which can be provided with any signature you want them to have.
Any Application Service has to be implemented by you. Thereby, you can rely on the Entity Services generated for your business objects.
If you want to deal with sets of objects like line items, you should model a set type LineItemList or so which wraps the set of items. Otherwise, you won't be able to expose your Application Service as a Web Service.
You could now implement an Application Servcie operation which takes a Header object as well as a LineItemList object as input parameters. However, it is questionable if you should deal with multiple business object types in one Application Service operation. Implementing multiple operations which rely on keys might result in a better design.
Best regards
Alexander

Similar Messages

  • Edit entity object and use the Create() method for generating ID's

    Hello,
    I have and InserPage.jsp and defined the datasoucre correctly.
    <jbo:InputText datasource="ds" dataitem="Clientid" /> gives me
    the unique ClientID from the FIRST client-record in my table ,
    although this page is for inserting a NEW Client, with a new
    ClientID.
    So, on the Clients Entity i made a create() method and put the
    following code in it:
    public Number getClientid() {
    return (Number)getAttributeInternal(CLIENTID);
    public void create(AttributeList attributeList) {
    SequenceImpl seq = new SequenceImpl
    ("Clientid",getDBTransaction());
    Integer i=(Integer)seq.getData();
    setClientid(new Number(i.intValue()));
    super.create(attributeList);
    the getData() Returns a sequence value, but what sequence value?
    Do i have to create a sequence on the ClientID column in my
    Oracle Table in the DB too?
    The problem is, the first ClientID # is 819 and the current last
    one seems to be 2899, so how do i achieve that when opening the
    insert.jsp the new ClientID shows up (ie. 2900)?
    How can i achieve this?
    thx

    OK, managed to track down the HowTo on triggers? I created the
    trigger.
    create sequence client_seq
    start with 8900
    increment by 1
    nomaxvalue
    nocycle;
    I changed the create() method for the entity object to:
    public void create(AttributeList attributeList) {
    SequenceImpl seq = new SequenceImpl
    ("Clientid",getDBTransaction());
    SequenceImpl s = new SequenceImpl("client_seq",
    getDBTransaction());
    Integer next = (Integer)s.getData();
    setClientid(new Number(next.intValue()));
    and running the tester for the module works fine. ;-)
    But...
    The Insert.jsp page has to insert/show this sequenced value!
    After i defined the datasource and let us say:
    <jbo:InputText datasource="ds" dataitem="Clientid" />
    ...the number 819 shows up, which is the FIRST record, so i do
    not get the new ClientID with the correct number.
    Any help is always nice. ;-)

  • Multiple create methods of entity beans in single transcation

    Hi,
    I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transaction type is Container Managed for all its methods.
    In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creating two entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch block.
    I want that the entire operation be under just one transcation so i have also given the transaction attribute as Required for all methods of Session bean and Entity Beans.
    However if i pass invalid parameters to second create method so that it generates exception then still the first create statement is successful and database is updated.
    what i want is that the first create also should be roll backed.
    How can i acheive this through Container Managed Transaction Session Bean?

    Hi Ashwini,
    "Ashwini" <[email protected]> wrote in message news:400291af$[email protected]..
    I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transactiontype is Container Managed for all its methods.
    >
    In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creatingtwo entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch
    block.
    >
    I want that the entire operation be under just one transcation so i have also given the transaction attribute asRequired for all methods of Session bean and Entity Beans.
    >
    However if i pass invalid parameters to second create method so that it generates exception then still the firstcreate statement is successful and database is updated.
    what i want is that the first create also should be roll backed.
    How can i acheive this through Container Managed Transaction Session Bean?o Do you use TXDatasource with your entity beans?
    o In CMT transactions are automatically rolled back only when RuntimeExceptions
    are thrown. What kind of exception is thrown in your case?
    Regards,
    Slava Imeshev

  • How to customizer entity create() method and doDML() just ?

    hi,
    I want to customizer entity create() method out of entityimpl java class,just like customer validator rule ,it will be used by many entity,so I can programly control default value such as database function or procedure,and more i want to write customer doDML() procedure with parameter,where and how can i do?
    thanks very much
    lixz
    2006.12.11

    hi,thank you frank
    but what you said is not what i want.eg,I have two entities,users(userid,last_name,first_name),product(prodid,name,specification) ,I want to set useid,last_name by set some property :Inparameter(a,b),setField(userid,last_name),Function_name(set_default_value) and can set product entity some field defaul value,and i only need to supply inparameter(a,b,c),setField(name,specification) ,function_name(another_set_default_value).customer validator (srdemoadfbc datemustcomeafter rule) can do the very thing what i want ,but can it only execute during validating,do you unstand what i say and give me some help?
    thanks
    lixz 2006/12/12

  • Exception when invoking create method on entity ejb's home object

    I have a simple entity bean. I am able to get the reference to the entity's home object. But when I run create method on entity's home interface, I get the following exception. The create method takes no arguments as the primary key is Auto-Increment field in MYSQL database. Here is the exception. I am using jdeveloper and embedded OC4J as server.
    07/06/22 15:51:15 java.lang.NullPointerException
    07/06/22 15:51:15 at EmployeeHome_EntityHomeWrapper2.create(EmployeeHome_EntityHomeWrapper2.java:1168)
    07/06/22 15:51:15 at com.pd.EmpAddInput.addEmployee(EmpAddInput.java:64)
    07/06/22 15:51:15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    07/06/22 15:51:15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    07/06/22 15:51:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    07/06/22 15:51:15 at java.lang.reflect.Method.invoke(Method.java:585)
    07/06/22 15:51:15 at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
    07/06/22 15:51:15 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
    07/06/22 15:51:15 at javax.faces.component.UICommand.broadcast(UICommand.java:332)
    07/06/22 15:51:15 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
    07/06/22 15:51:15 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
    07/06/22 15:51:15 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
    07/06/22 15:51:15 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
    07/06/22 15:51:15 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
    07/06/22 15:51:15 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
    07/06/22 15:51:15 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:712)
    07/06/22 15:51:15 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:369)
    07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:865)
    07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:447)
    07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:215)
    07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
    07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
    07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
    07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
    07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
    07/06/22 15:51:15 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    07/06/22 15:51:15 at java.lang.Thread.run(Thread.java:595)
    What may be causing this exception.

    I have solved the problem. It had to do with the autocommit=true feature of the MYSQL connection. However I have ran into another trouble. I am getting the following exception.
    java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
         at com.evermind.server.ejb.EJBUtils.throwGetPrimaryKeyInEJBCreateException(EJBUtils.java:892)
         at EmployeeRemote_EntityBeanWrapper0.getPrimaryKey(EmployeeRemote_EntityBeanWrapper0.java:1686)
         at EmployeeHome_EntityHomeWrapper2.create(EmployeeHome_EntityHomeWrapper2.java:1055)
         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:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:125)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:517)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:461)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at __Proxy0.create(Unknown Source)
         at com.pd.model.EmployeeRemoteClient.main(EmployeeRemoteClient.java:37)
    I am not calling getPrimaryKey() in ejbCreate() then why this exception

  • BC4J with Struts using EditAction's create method.

    Hi,
    I am using BC4J with struts and using the EditAction and UpdateAction classes provided by BC4J.
    When i want to create a new row in the database the documentation asks me to call EditAction's create() method and then UpdateAction's execute() method to do it. But even when i just call UpdateAction's execute() method I am able to create a new row. So WHY should I call EditAction's create() method ?????

    EditAction's create() method is something you would call in the action before rendering the empty form for the user to fill in.
    It creates a row, and then marks the row as having STATUS_INITIALIZED using the Row.setNewRowState(Row.STATUS_INITIALIZED) call.
    By setting the row to STATUS_INITIALIZED, this makes BC4J "forget" that it's a new row that needs to be inserted. In effect, it makes that new row a throwaway row used only for the purpose of rendering the blank form. An important reason you would want to do things this way is to pickup entity-level default values in the attributes of the new row.
    For example, in the toy store demo, why is it that when you register as a new user the "Country" poplist defaults to "United States" ? (it's not the first entry in the list).
    The answer is that, since the EditAction (or in this case my custom subclass of that) creates the blank row, the fact that the "toystore.model.businessobjects.Account" entity object declares that its Country attribute has a default value of "US" makes the blank row created in the "toystore.model.dataaccess.Accounts" view object have a default value of "US", and that default value in the blank row causes the <jbo:InputSelect> tag that renders the poplist to mark the corresponding "United States" option in the list as currently selected (as it's the display string associated in the poplist with the value "US").

  • I have file with 500 pages created from AutoCad file. In all pages, I have different document numbers.The file is not editable in pdf. How to change all the document numbers using "Comment" feature? Any alternate method?  alternate method? I have Adobe Ac

    I have pdf file with 500 pages created from AutoCad file. In all pages, I have different document numbers.The file is not editable in pdf. How to change all the document numbers using "Comment" feature? Any alternate method?  alternate method? I have Adobe Acrobat X Pro and Windows -7 platform.

    Yes, I just want to cover up all the pages for those particular area of document numbers.
    Nothing sensitive about it. I just want to show the correct document numbers on all pages in print out.
    So, I wanted to cover up by comments, but commenting on each page will be difficult. So, I wanted to comment the same on all pages.

  • The entity with header id(2) generated the following errors

    Hi all,
    While Implementing in Maintenance Workbench am receiving this error message" The entity with header id(2) generated the following errors".
    Although after the error, half of the work orders have been implemented. that means if there are 12 scheduled works in that 6 have been implemented. Please explain dis. We r using R12.0.6

    Hi,
    Can you find any details about the error in the log files?
    Regards,
    Hussein

  • Default Image with created Method on HTML Client

    Hi,
    I have an entity called "Users" and I would like to show a default image for the user when New User screen appears.
    Somebody knows how to achieve that on the "created" method of entity for HTML (JavaScript)?
    Thanks in advance!
    Jesús

    HI Helmut,
    When you help secure your application, the final step is to publish it. When you publish for the first time, you must provide authentication information for a default administrator. When you publish again, you don’t have to repeat this step.
    To provide authentication information when you publish an application
    1.  
    In the LightSwitch Publish Application Wizard, choose the Security Settings page, and then choose the Yes, create an Application Administrator option button.
    2.  
    In the User Name text box, enter a username.
    3.  
    If you’re using Windows authentication, you must specify a valid Windows logon name that has the form Domain\Username.
    For this issue, you can also repair your Lightswitch, and check whether it helps fix it.
    For this issue, here are a few suggestions that might help:
    •Clean and Rebuild - Cleaning and rebuilding your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 
    •Consider Restarting Visual Studio - If these issues are still persisting after the above steps, try restarting Visual Studio (and even your local machine
    Please let me know if there is anything that I can do to help.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Defaulting logic in entity create method

    Hi
    As suggested by BC4J I use the create method of my entity object to insert defaulting logic for some attributes. The code looks like this:
    protected void create(AttributeList attributeList)
    super.create(attributeList);
    Number seqNumber = new Number();
    SequenceImpl s = new SequenceImpl("REV_SEQ", getDBTransaction());
    seqNumber = s.getSequenceNumber();
    setRevId(seqNumber);
    setCreationDate(SamUtils.getSystemDate());
    ApplicationModule am = getDBTransaction().getRootApplicationModule();
    if (am instanceof SecuredApplicationModule)
    setUsrId(((MyApplicationModule) am).getUsrId());
    But executing this code results in an Exception: "JBO-25014: Other User has changed the Row". If I remove the code between the lines above everything works ok.
    My questions are:
    - Is it ok to use set-Methods in the entity create method? Or should I set my default values to the "attributeList" instead?
    - do you think it is a problem to use the ApplicationModule as shown? I should mention that am.getUsrId() simply returns a previously stored variable and does not perform any queries or alike.
    Thanks for your help
    Frank Brandstetter

    It's definitely fine to setAttributes - I've done it myself (but not using "specific" setters).
    I haven't used the built-insequences before - this bit of your code looks a bit wasteful in terms of object creation, but that's obviously not your issue....
    It looks fine to use an application module in such a way; I coded a "current user id" function on mine too.
    I actually suspect the date-attribute, since I (me again!) had some "concurrent user" problems too. The issue was the fact that a Java date is accurate to the millisecond, and the database storage and retrieval wasn't. (I wasn't using Oracle so I'm not sure how it goes there....) A "concurrent user" exception gets thrown when bc4j goes to update an entity and finds that the date-value in the object doesn't match the "rounded" one it retrieves (as a check, just before it does the update - this is the optimistic locking) from the database. [So does the error occur only when you've saved the new entity once, then update it and try to save it again?]
    I got around it by setting the millisecond portion of any dates I used to zero (since the "storage" was accurate to a second) - so you might try that. (Did it generically in prepareForDML in my own Entity superclass, I think.)
    Otherwise, try setting the attribute, but not in the create method, and seeing if you get the same problem...
    HTH
    Mike.

  • I Have Purchase ipod touch with ios5 . while create apple id  the none option in Payment Method dose not Apper . I dont have any visa or mastercard . plese help ?

    I Have Purchase ipod touch with ios5 . while create apple id  the none option in Payment Method dose not Apper . I dont have any visa or mastercard . plese help ?
    How Shold I Proceed

    Hello JadeGirl13,
    Thanks for using Apple Support Communities.
    Please see the support article below that explains why you may not be able to select none as a payment type.
    Why can’t I select None when I edit my Apple ID payment information?
    http://support.apple.com/kb/TS5366
    Take care,
    Alex H.

  • Import tables with nested table : ORA-00600

    In Oracle 9.2
    Create object, type as table, and table with nested table (store as syms_ntab) are successfully.
    Also its export.
    In process of import on another server (also 9.2, 'fromuser=one touser=two') shows errors:
    . . importing table "SYMS_NTAB"
    IMP-00058: ORACLE error 600 encountered
    ORA-00600: internal error code, arguments: [kokeeafi1], [2], [2], [], [], [], [], []
    IMP-00075: Warning: The nested table may contain partial rows or duplicate rows
    But for all that table is created and error occur on phase inserting strings.
    What is this?
    In Oracle 8.0.5 i perform similar operation without error.

    From Oracle error messages and codes manual:
    ORA-00600 internal error code, arguments: [string], [string], [string], [string], [string], [string], [string], [string]
    Cause: This is the generic internal error number for Oracle program exceptions. It indicates that a process has encountered a low-level, unexpected condition. Causes of this message include:
    * timeouts
    * file corruption
    * failed data checks in memory
    * hardware, memory, or I/O errors
    * incorrectly restored files
    The first argument is the internal message number. Other arguments are various numbers, names, and character strings. The numbers may change meanings between different versions of Oracle.
    Action: Report this error to Oracle Support Services after gathering the following information:
    * events that led up to the error
    * the operations that were attempted that led to the error
    * the conditions of the operating system and databases at the time of the error
    * any unusual circumstances that occurred before receiving the ORA-00600 message
    * contents of any trace files generated by the error
    * the relevant portions of the Alter files
    Note: The cause of this message may manifest itself as different errors at different times. Be aware of the history of errors that occurred before this internal error.

  • Fill datagridview with Nested Table Object Type ???

    Hello everybody, please you help me resolve my problem?
    I follow this example: *(A Sample Application using Object-Relational features)* http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10799/adobjxmp.htm
    And this tutorial: *(Using Oracle User-Defined Types with .NET and Visual Studio)* http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm
    Now I have 3 Object Table: Stock, Customer and Purchase Order. With the tutorial it's OK to show the data of Stock and Customer Table [there is no nested table in], but I can't do this with table Purchase Order, the tutorial don't show how to work with Nested Table type [Missing or something ?]
    When I try to display the data of table Purchase Order, I get the error:
    typeName='LINEITEMLIST_NTABTYP'' is not specified or is invalid*
    Follow the tutorial, I generate custom class for this UDT and get another error:
    this.STOCK_REF = ((object)(Oracle.DataAccess.Types.OracleUdt.GetValue(con, pUdt, "STOCK_REF")));*
    Argument Exception Unhandle: Object attribute is not mapped to a custom type member.*
    Can You show me how to do this ? Show the data of the Nested Table in Visual Studio, do I have something wrong ??? Thanks and Best Regards.

    I think you need to go through the tutorial more carefully. I think you are missing steps.
    You are using a REF. Are you creating an object table for the objects to be stored in? Are you dereferencing the REF? This is covered by the Oracle by Example tutorial.
    http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm#t11
    When you receive the nested table, it will be inside a .NET class. You can create this class by using the Create Custom Class menu item on the nested table type in server explorer.
    This class will contain a ToString method and a ToXML method.
    The question is, where are you attempting to display the data from this nested table? In a grid?
    Does it make sense to display a nested table inside one cell of a grid? No. You would need to construct a special UI that will show the
    nested table. Maybe the user clicks on the cell on the grid, which opens a new grid that displays the data. Or maybe there is a second grid on the form that always shows the nested table for the row that the first grid currently has selected.
    I realize I am not providing you the code... but it sounds like you need to design a more sohisticated UI than what the tutorial is using -- one that can handle displaying one additional table per row.

  • How to persist an entity with Composite primary key

    Problem Statement:-
    Entity A have many to one relation with Entity C
    Entity B have many to one relation with Entity C
    Entity C have a composite primary key of (Entity A PK & Entity B PK)
    A --< C
    B --< C
    the entites are automatic generated by Dali tool
    @Entity
    public class C implements Serializable
         @EmbeddedId
         private C.PK pk;
         private int attribute;
         //Code
         @Embeddable
         public static class PK implements Serializable
              public int A_Id;
              public int B_Id;
              //Code
    @Entity
    public class A implements Serializable
         @Id
         private int AId;
         @OneToMany
         private Set<C> C_Collection;
         //Code
    @Entity
    public class B implements Serializable
         @Id
         private int BId;
         @OneToMany
         private Set<C> C_Collection;
         //Code
    i made a session Bean which add a new entity C
    Session
         A a = em.find(A.class, AId);
         B b = em.find(B.class, BId);
         C c = new C();
         C.PK pk = new C.PK();
         pk.AId(a.getID());
         pk.BId(b.getID());
         c.setPk(pk);
         c.setA(a);
         c.setB(b);
         c.setAttribute(12);
         em.persist(c);
    when running this code an exception is raised
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'A_ID' in 'field list'Error Code: 1054
    Call:INSERT INTO C (attribute, Aid, A_ID, B_ID, Bid) VALUES (?, ?, ?, ?, ?)
         bind => [2, 6, 6, 1, 1]
    this is logic as Table "C" has only 3 coloumns only "attribute" , "Aid" , "Bid"
    but the mapping is different as it adds the composite PK attributes to the insert statement
    if there is a sample code or how to solve this issue it would be great

    Hello Juwen,
    The problem is you are registering an object, assigning it a null pk, and then commiting the uow/transaction. TopLink uses registered objects to keep track of changes you make inorder to persist those changes on commit. So the simple fix is to not commit the UnitOfWork - call release() on it instead.
    Another solution is to use the session copyObject api. The simple form that only takes an object will work similar to registering the object as it will copy all persistent attributes but it will leave the primary key null. You can also use this method to specify a copyPolicy to customize the process. Using this method will be a bit more efficient, since a UOW makes both a working copy and a back up copy of objects registered, inorder to keep track of changes. Using the copyObject api will only make a single copy.
    Best Regards,
    Chris

  • How to work with nested tables

    HI Everybody,
    I have a relational table one of whose columns is an object and another column is a collection stored as a nested table. I would like to set up a user interface ADF Rich Client, where I consider the parent table as Master and the nested table as Detail. If I build a READONLY master and detail view with a view link based on the primary key of the parent table, it works fine. However, when I try to generate entities from the views, the detail view object disappears from JDeveloper. Otherwise, when I try to make business components from tables, the nested table is not listed. Do anyone know a solution?
    Please help!
    Here is the view creation script with table structures:
    create or replace view dp_master_view as
    select p.dept_no,p.dept_name, p.dept_mgr.idno mgr_idno, p.dept_mgr.name mgr_name,p.dept_mgr.phone mgr_phone from department_persons p
    create or replace view dp_detail_view as
    select p.dept_no,e.* from department_persons p,table(p.dept_emps) (+) e
    SQL> desc department_persons
    Name Null? Type
    DEPT_NO NOT NULL NUMBER
    DEPT_NAME CHAR(20)
    DEPT_MGR PERSON_TYP
    DEPT_EMPS PEOPLE_TYP
    SQL> desc person_typ
    Name Null? Type
    IDNO NUMBER
    NAME VARCHAR2(30)
    PHONE VARCHAR2(20)
    Thanks, regards
    Miklos HERBOLY

    HI Everybody,
    I have a relational table one of whose columns is an object and another column is a collection stored as a nested table. I would like to set up a user interface ADF Rich Client, where I consider the parent table as Master and the nested table as Detail. If I build a READONLY master and detail view with a view link based on the primary key of the parent table, it works fine. However, when I try to generate entities from the views, the detail view object disappears from JDeveloper. Otherwise, when I try to make business components from tables, the nested table is not listed. Do anyone know a solution?
    Please help!
    Here is the view creation script with table structures:
    create or replace view dp_master_view as
    select p.dept_no,p.dept_name, p.dept_mgr.idno mgr_idno, p.dept_mgr.name mgr_name,p.dept_mgr.phone mgr_phone from department_persons p
    create or replace view dp_detail_view as
    select p.dept_no,e.* from department_persons p,table(p.dept_emps) (+) e
    SQL> desc department_persons
    Name Null? Type
    DEPT_NO NOT NULL NUMBER
    DEPT_NAME CHAR(20)
    DEPT_MGR PERSON_TYP
    DEPT_EMPS PEOPLE_TYP
    SQL> desc person_typ
    Name Null? Type
    IDNO NUMBER
    NAME VARCHAR2(30)
    PHONE VARCHAR2(20)
    Thanks, regards
    Miklos HERBOLY

Maybe you are looking for