EJB 3.0: How to merge detached entity with collection

Hello,
suppose you have 2 database tables: PARENT and CHILD with one-to-many association. In a session bean you load the parent entity together with collection of children and send it all to client. Client might change parent or child data, add/remove children.
Now back in a session bean you want to update database, so you call:
entityManager.merge(detached_parent_entity);Problem is, that removed child objects from entity bean collection are not deleted from database. Bacause I am currently using Hibernate, I could follow the FAQ (http://www.hibernate.org/116.html#A17) and add delete-orphan cascade, but I don't want to be tight to Hibernate nor other frameworks.
Is there any sexy solution?
Thanks for replies!

I'm afarid not - a generic feature that will allow to
delete orphan children didn't make it into the final
spec.
regards,
-marinaDo you happen to have any links to public discussions about this feature with regard to the development of the spec? This is a very nice feature in Hibernate and it's absence in EJB 3.0 is rather disappointing.
Thanks.

Similar Messages

  • How to execute a procedure with collection passed as parameter?

    i have created the collection:
    CREATE TYPE typ_Project AS OBJECT( project_no NUMBER(2), title VARCHAR2(35), cost NUMBER(7,2))
    CREATE TYPE typ_ProjectList AS VARRAY (50) OF typ_Project
    and a procedure:
    CREATE OR REPLACE PROCEDURE add_project (
    p_deptno IN NUMBER,
    p_new_project IN typ_Project,
    p_position IN NUMBER )
    IS
    v_my_projects typ_ProjectList;
    BEGIN
    SELECT projects INTO v_my_projects FROM department
    WHERE dept_id = p_deptno FOR UPDATE OF projects;
    v_my_projects.EXTEND;
    FOR i IN REVERSE p_position..v_my_projects.LAST - 1 LOOP
    v_my_projects(i + 1) := v_my_projects(i);
    END LOOP;
    v_my_projects(p_position) := p_new_project; -- add new
    UPDATE department SET projects = v_my_projects
    WHERE dept_id = p_deptno;
    END add_project;
    Now please explain how to call this procedure with collection passed as parameter . . .

    For example:
    BEGIN
        add_project(
                    10, -- department number
                    typ_Project(
                                99, -- project number
                                'New Project', -- project title
                                99999.99 -- project cost
                               ), -- new project
                    5 -- project position
    END;
    /SY.

  • How to save an entity with description and a file?

    Hi everybody!
    I have an entity Video:
    @Entity
    public class Video {
    @PrimaryKey
    private String title;
    @SecondaryKey(relate = MANY_TO_ONE, relatedEntity=Journalist.class)
    private String jorName;
    @SecondaryKey(relate = MANY_TO_ONE, relatedEntity=Operator.class)
    private String oName;
    @SecondaryKey(relate = MANY_TO_ONE)
    private Date date;
    @SecondaryKey(relate = MANY_TO_ONE)
    private String place;
    private File file;
    the video accesor for PK is:
    PrimaryIndex<String,Video> pIdx=store.getPrimaryIndex(String.class, Video.class);
    A user opens a form(it is written in swing) and fills in the title, name of the author, date, place of the video and browsers a file from some source. Now the user presses button "upload" and the whole object must be put to database. I dont understand how the whole object(file with filled description) can be put to db?
    Below is actionPerformed function:
    public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (e.getSource() == btnBrowse) {
    int returnVal = fc.showOpenDialog(VideoPanel.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    textField.setText(file.toString());
    if(source == btnUpload){
    if(text1.getText().equals("")&&text2.getText().equals("")&&text3.getText().equals("")){
    //how to put the whole object?
    Thanks in advance!

    Hello,
    I dont understand how the whole object(file with filled description) can be put to db?Have you read the documentation and examples about how to use the com.sleepycat.persist API to write and read persistent objects? If so, what specifically is confusing? Be sure to look at the example programs.
    We can help with questions about our APIs, once you've read the doc, but please understand that we won't be able to supply you with the code to integrate with your Swing app -- that's your job.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need to know how to merge interactive form with text page pdf

    I have an interactive pdf form, I need to merge this with another pdf page which is not a form. Kindly advice how I can do so using Adobe livecycle or acrobat pro X.
    Regards,
    Pooja

    Hi Pooja,
    How is your Interactive PDF form is created(LC Designer or Acrobat X). If you used LC Designer then you cannot merge the page, the only option is to create a new page in designer and copy and paste the content.
    If you used acrobat to create the Form then you easily merge the PDFs using combine feature in Acrobat.( File> Create> Combine files)
    Hope this helps. Let me know if you have any other question.
    Regards,
    ~Pranav

  • How to persist an entity with (any) Serializable Java Object as a field?

    Hello,
    I've understood, that in addition to basic and primary types, an entity bean can have basically any serializable object as its field. I just can't get it working. All I want, is just to have an entity bean with, for example, a HashMap or Properties as one of the its fields. And afterwards, when I'd query the bean again from the persistent storage, it would have the HashMap or Properties fields set just as they were while persisting the bean. So the basic functionality.
    So far, the only way I've gotten this working, is by defining the field as byte[] and then by using ObjectInput/OutputStreams and ByteArrayInput/OutputStreams I can read/write my HashMap or Properties as a byte[] and persist the entity... Not very clever, is it :)
    I've tried to annotate the field with @Lob but it eventually ends up with casting problems when fetching the data from the persistent storage, because TopLink gets a blob, a byte array from the persistent storage and doesn't know how to convert it into HashMap or Properties like I want it to.
    This was close to mine, but still didn't get it working..
    http://forum.java.sun.com/thread.jspa?threadID=749447&messageID=4287919
    ps. Working with AS PE9, MySQL and PostgreSQL..
    Best regards,
    Samuli

    Hello,
    Sorry, I'm not sure what you mean. The ID used for the entity does not need to match the actual database constraints, so you can use any mapping in the entity as the ID as long as its value will be unique. If it is not unique, you will run into problems when EclipseLink thinks the entity already exists, performing an update instead of an insert.
    Can you describe the performance problems you are having, and what type of sequencing you are using? It is possible to improve performance using batch writing and sequence pre-allocation.
    See http://wiki.eclipse.org/Optimizing_the_EclipseLink_Application_(ELUG)#How_to_Use_Batch_Writing_for_Optimization
    and http://wiki.eclipse.org/Optimizing_the_EclipseLink_Application_(ELUG)#Table_11-11 for some of the options available.
    Best Regards,
    Chris

  • How to merge .m4v files with chapters included?

    I am unable to merge two .m4v files in quicktime pro and keep their chapter structure. Is this even possible? I take a lot of time to build chapters into movies I make and I would like to be able to combine some AND keep the chapter structure.
    Here is what I have:
    Movie A: 12 chapters
    Movie B: 10 chapters
    open movie A in quicktime pro
    open movie B in quicktime pro
    copy movie B (command+A, command+C)
    select movie A
    push needs to end of movie A
    paste clipboard (command+V)
    Result:
    Movie A now has it's original 12 chapters and then the added movie B is just one long section added on to the end of Movie A's last chapter.
    Any help would be appreciated. This seems to be an ongoing question on many forums.
    -i

    1) is there any way to use your method that give me a final .m4v?
    Well, your questions are certainly getting harder. How a bout no, yes, and maybe.
    a) No, I do not know of a direct approach for simply changing the file container. As you may have noted, QT now checks the Video Track "Sample Description" and if the extension does not match the description, QT sends you a "nastygram" modal message and refuses to open the file.
    b) Yes, it can be done indirectly. In this case I used the SimpleMovieX ($35) from Aero Quartet of Catalonia, Spain. While I tend to use QT Pro and MPEG Streamclip for most day-to-day work, this application does have some unique features to which I resort when needed. One is the "Keyframe" combined indicator/skip option, one is its audio manipulations, and another is the way it handles H.264/AAC MOV file container conversion. (I also do a lot of "track management" work that leaves me in an MOV file when I actually want MP4 or M4V file container features like being able to associate external "artwork" images in iTunes.) In any event, this application does actually go through and correct the descriptors before it copies the appropriate data to the new container making QT ever so happy with the new MP4 container. At this point, if I modify the MP4 Extension to M4V in the Finder, QT then does not issue the modal message and does use iTunes as the default application to open the file.
    c) Maybe the file is considered to be a real M4V file and maybe it is not. I have not, for instance tried to add a "Passthrough" AC3 secondary audio track and check to see if the resulting file will play correctly via TV. So there may yet be some internal distinctions of which I am yet unaware. Other than that, the file does indeed seem to function as any other iTunes file created by direct M4V data compressed export.
    Anyway, this is from the "for whatever it is worth" department and you can invest $35 in the application or try to find another application capable of doing the same thing. MPEG Streamclip, for instance, will not work here but I have not actually looked around for anything else.
    2) if I use the final .MOV that you get at the end of your tutorial, will exporting as "apple tv" or mpeg 4 etc. compress it again?
    Yes, it will. In addition, depending on the application used to perform the export, you may lose the chapter track also.

  • 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 merge source data with RFC response and post back again as Idoc

    Hi All,
    This is the requirement we have for an interface
    The legacy application is sending Vendor master to PI 7.0
    If it is new vendor then it is send as an Cremas Idoc into SAP. Legacy (New Vendor) -
    > PI 7.0  -
    >Cremas Idoc SAP
    If it is changed Vendor legacy will only send changed fields for that Vendor.In PI we would like to call an RFC which will return all the data for that changed Vendor Number and then merge the RFC response with changed data from legacy and then send it to SAP as Cremas Idoc again with all values.
    I know these can be achieved using Proxy by custom Abap Code in SAP.But we would like to avoid it.
    How can we achieve it?
    1.RFC lookup - Shall we use these , when PI receives changed Vendor from legacy ,it will call RFC using RFC lookup and the response message from RFC lookup should be merged with source data .Is this possible?
    2.Shall we achieve this using BPM ?Is it feasible and How?
    Any Help greatly appreciated
    Thanks,
    V

    If it is changed Vendor legacy will only send changed fields for that Vendor.In PI we would like to call an RFC which will return all the data for that changed Vendor Number and then merge the RFC response with changed data from legacy and then send it to SAP as Cremas Idoc again with all values.
    I am not sure why you want to pull whole data from R3 and send back to R3.
    you can follow any of these approach..
    if you have any indicator for new/ changed cusotmer in the legacy data then trigger CREMAS IDoc accordingly.
    mapping rules will be diffrent for New and changed CREMAS idoc.
    otherwise just do RFC look up for each record then based on the output(new/changed) create or update cusotmer data through CREMAS IDoc.
    when changing the customer through CREMAS no need to pass whole data again. it is enough if pass the changed fields. offcourse qualifier values  for segments will differ.

  • How to merge 4 files with VBA

    I have 4 files that I want to automatically merge using Visual Basic for Applications Code. I've searched through this forum and it seems that first you open the first pdf with PDDoc and then you use PDDoc.InsertPages to add the 2nd PDF and so on. Note these 4 files are each one page long. I am using Adobe Acrobat Professional and no this is not a server based application that I am developing. I am not interested in Adobe Live Cycle Designer. I am having difficulty inserting the page. I do not know how to define/specify the iPDDocSource As Object. The code I have written so far is below. Note eventually I want this to be invisible (ie PDDoc), but being able to perform using AVDoc could also be useful. Thanks.
    Dim Path As String, Path1 As String, Path2 As String
    Dim Path3 As String, Path4 As String
    Dim gApp As Acrobat.AcroApp
    Dim gPDDoc As Acrobat.AcroPDDoc
    Dim iPDDocSource As Acrobat.AcroPDDoc
    Dim jso As Object
    Dim gAVDoc As Acrobat.AcroAVDoc
    Path = "C:\junk" & "\"
    Path1 = Path & "1.pdf"
    Path2 = Path & "2.pdf"
    Path3 = Path & "3.pdf"
    Path4 = Path & "4.pdf"
    Dim WshShell As IWshRuntimeLibrary.WshShell
    Set WshShell = CreateObject("Wscript.Shell")
    WshShell.CurrentDirectory = "C:\Program Files\Adobe\Acrobat 8.0\Acrobat\"
    WshShell.Run "Acrobat.exe"
    Set gApp = CreateObject("AcroExch.App")
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    Set gAVDoc = CreateObject("AcroExch.AVDoc")
    'Set iPDDocSource = CreateObject("AcroExch.PDDoc")
    ok = gAVDoc.Open(Path1, "1") 'This works
    ok3 = gPDDoc.InsertPages(0, iPDDocSource, 0, 1, 0)
    '<-- Problem here with iPPDocSource
    Set gAVDoc = Nothing
    End Sub

    I am an absolute hack when it comes to programming in Visual Basic. In the past as a Structural Engineer I have programmed a lot in Fortran, but I have also written programs in a lot of other languages as well. However, programming is not my primary job, but I am better at it than your first impression implies, but not by much. I accidentally omitted the Sub MergePDF() text at the top of the code. This routine is part of a larger program run from MS Excel VBA that is already complete. Yes I do tend to kludge stuff together until it works, thats what examples are for. Therefore I made multiple dims and other declarations that aren't necessary because I do not have a familiarity with the Adobe SDK. However, the Acrobat SDK is not as intuitively obvious to the casual observer as you would have me believe. It seems to be written more for the C and Java programmers. All of that aside you did help me solve my problem so thank you. Thanks Reinhard for the code that may give me other ideas to explore. The following code was all I required for my current application.
    Sub MergePDF()
    Dim Path1 As String, Path2 As String, Path3 As String, Path4 As String
    Dim gPDDoc1 As AcroPDDoc
    Dim gPDDoc2 As AcroPDDoc
    Dim gPDDoc3 As AcroPDDoc
    Dim gPDDoc4 As AcroPDDoc
    Set gPDDoc1 = CreateObject("AcroExch.PDDoc")
    Set gPDDoc2 = CreateObject("AcroExch.PDDoc")
    Set gPDDoc3 = CreateObject("AcroExch.PDDoc")
    Set gPDDoc4 = CreateObject("AcroExch.PDDoc")
    chk1 = gPDDoc1.Open("C:\junk\1.pdf")
    chk2 = gPDDoc2.Open("C:\junk\2.pdf")
    chk3 = gPDDoc3.Open("C:\junk\3.pdf")
    chk4 = gPDDoc4.Open("C:\junk\4.pdf")
    mergefile = gPDDoc1.InsertPages(0, gPDDoc2, 0, 1, 0)
    mergefile = gPDDoc1.InsertPages(1, gPDDoc3, 0, 1, 0)
    mergefile = gPDDoc1.InsertPages(2, gPDDoc4, 0, 1, 0)
    savemergefile = gPDDoc1.Save(1, "C:\junk\merged.pdf")
    End Sub

  • How to merge an openActivity with the conflicting activity

    Hi all,
              I checked out the activity which is already checked out by another developer.He checkedIn that activity.Now if i tried to checkIn i am getting an error as Conflict in CheckIn .I had gone through some documents regarding Merging of Activites which are conflicted.
    Can anyone give me step by setp procedure for merging 2 Conflicting activites
    Regards
    Padma N

    Hi,
    1. Open the &#8220;Integration Conflict&#8221; view to display where the version conflict occurred.
    2. Select &#8220;Auto Merge&#8230;&#8221; from the context menu. The list of the source code with conflicts will be displayed.
    3. Select the relevant source code and choose &#8220;Merge Conflict Manually&#8221; from the context menu. The two source code versions will be displayed and will indicate the conflict line.
    4. Choose &#8220;Accept changes&#8221; after resolving the conflict by merging the code lines.
    Also go through the help content on 'Resolving Conflict'
    http://help.sap.com/saphelp_nw70/helpdata/en/44/42dfb4709914bce10000000a155369/frameset.htm
    Regards
    Srinivasan T

  • How to merge grayscale library with regular

    I'm guilty like many others o fmessing up my library. I now own library manager paid version and have rebuilt an old library. My newest one is in grayscale and won't launch. I can see it in the finder and view the photos. How do I get them back into a library that I can view and delete from.

    I'm not sure I understand your question
    iPhoto does not work with grayscale images - so I'm not clear on what you meant by having a greyscale library - plus color profile is a photo attribute, not a library attribute - and libraries should not be imported into iPhoto - they should be selected - launch iPhoto while depressing the the option (alt) key and use the select library option
    I'm not sure that I helped - but if not please post with more details
    LN

  • How to merge phone number with imessage on 10.8.2

    i updated to 10.8.2 and i had already been using imessage on 10.8.1 and before. i went to imessage and there is no option or alert or anything to add my phone number to it. i use the same apple id on my iphone and receive imessages at both my apple id email address and phone number. i have tried signing out, deleting all my messages, ive tried signing out restarting my macbook pro and signing back in, still nothing. any way to manually set it up or refresh the account?
    update: i guess everyone says i need to update my iphone to ios6 first. i'm just going to wait for my iphone5 on friday to set this up as im not yet going to update to ios6 on my 4S
    Message was edited by: vikgrover87

    Well, try as I might, and despite the publicity and hype around this and 'It just works' for me it just doesn't.  I updated the phone and ipad to IOS 6, MacBook to 10.8.2 and no matter what I do, how many log ins and outs the ipad and the Macbook ONLY give me the option to use one of two email addresses.  No phone number option is anywhere to be seen.  I did rather expect that I would just actvate imessage on the iphone and then do so on the ipad and macbook, merely having to select the number as the methof of contact, or even having it there as the default.  Too much to ask I suppose!! I find I spend far more time trying to get Apple innovation to work than I ever did with Windows to be honest!  I also tried entering the phone number many times and go many 'verification sent' only to receive squat.
    Sick and tired of trying to fathom this now so I gues I'll just leave it off rather than find myself back in the days of imessage confusion where some would go to a phone, some to an email, messages only being visible on certain devices depending on where they were sent - all the things that made imessage a complete PITA and far more trouble than it was worth.
    I hoped that maybe this would fix those problems.  Maybe it will, when I can invest the time in digging around the internet trying to get it to 'just work'!

  • How to merge the Panel with another Panel to One Panel?

    As Title!!

    i will give it a shot. by no means do i say it is correct being a beginner myself
    Panel aPanel = new Panel();
    Panel anotherPanel = new Panel();
    Panel mythirdPanel = new Panel();
    aPanel.add(anotherPanel);
    aPanel.add(myThirdPanel);
    this should create one panel called aPanel with two panels inside - another Panel first, followed by mythirdPanel second. This should be in FlowLayout pattern as that is default unless specified.
    That is my guess and my shot.
    8)

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to retrieve detached @ManyToOne entities with relationship

    Hi All,
    I am having difficulty retrieving all the Zipcode, Zipname records which have successfully been deployed on Glassfish v2r2, JDK1.6.0_06, MySQL 5.0, Netbeans 6.1 on Windows XP platform.
    Below are the relevant EJBs snippets:
    package domain;
    @Entity
    @Table(name="ZIPCODE")
    public class Zipcode implements Serializable {
        @Id
        @Column(name="ID")
        private int id;
        public int getId() {
            return id;
        @OneToMany(cascade={CascadeType.ALL}, mappedBy="zipcode", fetch=FetchType.EAGER, targetEntity=Zipname.class)
        private Collection<Zipname> zipnames = new ArrayList<Zipname>();
        public Collection<Zipname> getNames()
         return zipnames;
    package domain;
    @Entity
    @Table(name="ZIPNAME")
    public class Zipname implements Serializable {
        @Id
        @Column(name="ID")
        private int id;
        public void setId(int id) {
            this.id = id;
        @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="ZIPCODE_ID")
        private Zipcode zipcode;
        public Zipcode getZipcode() {
            return zipcode;
    package ejb;
    @Stateless
    public class ZipcodeBean implements ZipcodeRemote {
        @PersistenceContext(unitName="GeographicalDB") private EntityManager manager;
        public void createZipcode(Zipcode zipcode)
           manager.persist(zipcode);
        public Zipcode findZipcode(int pKey)
           Zipcode zipcode = manager.find(Zipcode.class, pKey);
            zipcode.getNames().size();
            return zipcode;
        public List fetchZipcodesWithRelationships()
          List list = manager.createQuery("FROM Zipcode zipcode").getResultList();
          for (Object obj : list)
             Zipcode zipcode = (Zipcode)obj;
             zipcode.getNames().size();
          return list;
    @Stateless
    public class ZipnameBean implements ZipnameRemote {
        @PersistenceContext(unitName="GeographicalDB") private EntityManager manager;
        public void createZipname(Zipname zipname)
         manager.persist(zipname);
        public Zipname findZipname(int pKey)
            Zipname zipname = manager.find(Zipname.class, pKey);
            zipname.getZipcode().getNames().size();
            return zipname;
        public List fetchZipnamesWithRelationships()
          List list = manager.createQuery("FROM Zipname zipname").getResultList();
          for (Object obj : list)
             Zipname zipname = (Zipname)obj;
             zipname.getZipcode().getNames().size();
          return list;
    public class ZipcodeApplicationClient {
        @EJB
        private static ZipcodeRemote zipcodebean;
        private static ZipnameRemote zipnamebean;
        public ZipcodeApplicationClient() {
        public static void main(String[] args) {
            try {
                Zipcode zipcode_1 = new Zipcode();
                zipcode_1.setcode(9001);
                Zipname zipname_1 = new Zipname();
                zipname_1.setName("Harbour Cove");
                zipcode_1.getNames().add(zipname_1);
                zipname_1.setZipcode(zipcode_1);
    //          zipnamebean.createZipname(zipname_1);
                zipcodebean.createZipcode(zipcode_1);
                //fetch detached entity without relationship
                Zipcode zipcode_2 = zipcodebean.findZipcode(0);
                System.out.println("zipcode_2.getId(): " + zipcode_2.getId());
                System.out.println("zipcode_2.getCode(): " + zipcode_2.getCode());
                Iterator iterator = zipcode_2.getNames().iterator();
                while (iterator.hasNext())
                    System.out.println(iterator.next().toString());
                // output of fetching detached entity without relationship
                zipcode_2.getId(): 0
                zipcode_2.getCode(): 2010
                domain.ZipName@107e9a8
                zipcode_2.getLatitude: -33.883
                zipcode_2.getLongitude(): 151.216
                zipcode_2.getLocality(): Sydney
                //fetch detached entity with relationship
                List list =  zipcodebean.fetchZipcodesWithRelationships(); // line 76         
                // output of fetching detached entity with relationship
                           Caught an unexpected exception!
                           javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA BAD_PARAM 1330446342 Maybe; nested exception is:
                           java.io.NotSerializableException: ----------BEGIN server-side stack
                           at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:76)
                           -------------------------------------------------------------------------------------------------------------------------------------------( i ) As a result, please advice on how to utilise both fetchZipcodesWithRelationships() & fetchZipnamesWithRelationships() in ZipcodeApplicationClient() to retrieve collections of Zipcodes & Zipnames without encountering this issue?
    (ii) I also like to utilise the zipnamebean.createZipnamez(zipname_1) to properly create this entity.
    The local firewall has been de-activated. All components reside on the same host.
    I have tried various approaches and googled without success.
    Your guidances would be very much appreciated.
    Many thanks,
    Jack

    Hi All,
    When trying to add multiple Zipnames with the following additional statements at the beginning of ZipcodeApplicationClient:
                Zipcode zipcode_1 = new Zipcode();
                zipcode_1.setcode(9001);
                Zipname zipname_1 = new Zipname();
                zipname_1.setName("Harbour Cove");
                zipcode_1.getNames().add(zipname_1);
                Zipname zipname_2 = new Zipname();
                zipname_2.setName("Fairyland");
                zipcode_1.getNames().add(zipname_2);
                Zipname zipname_3 = new Zipname();
                zipname_3.setName("Wonderland");
                zipcode_1.getNames().add(zipname_3);
                zipname_1.setZipcode(zipcode_1);
                zipname_2.setZipcode(zipcode_1);
                zipname_3.setZipcode(zipcode_1);
                zipcodebean.createZipcode(zipcode_1); // line 49
    The whole persistence step (line 49) failed altogether with these output:
    Caught an unexpected exception!
    javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.RemoteException: null; nested exception is:
            javax.persistence.EntityExistsException:
    Exception Description: Cannot persist detached object [domain.Zipname@1a6eaa4].
    Class> domain.Zipname Primary Key> [0]
    at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:49)Any ideas on why this occur?
    Thanks,
    Jack

Maybe you are looking for

  • JRE 1.4.x hangs under W2K (DirectX?, Nvidia?, ???)

    Whenever I try to run a Java app that has a graphical component, it hangs if I use a 1.4.x JRE, although it will run with 1.3.x (assuming, of course, the app supports 1.3). This will soon become critical because my company is about to make the move f

  • How to use "with clause query" in DBadapter

    Hi all, I need to implement a "with clause" query in oracle soa 11g bpel. When i put the query in db adapter in pure sql, the schema is not getting generated properly. Can any one suggest a solution to my problem. Regards, Kaushik

  • FGEN error -107411589​6

    Can anyone please explain the error listed below? I'm using the PXI-5761 and the NI streaming API to stream float 32 IQ files. I've added code to the API to modulate the data while streaming. My options are no modulation, AM, or FM. I can stream the

  • Interactive sort order display

    How can I display the order in which the user has clicked the report columns using interactive sort feature? If I apply the interactive sort on two columns and user sorts first Column1 and then (holding Shift key) sorts Column2, then it is different

  • Getting bad host error when trying to deploy simple web sample application

    hi, Can someone tell me why I'm getting this error when trying to deploy the simple web application from samples This is what it said: deploy_common: [echo] Deploying ../assemble/war/webapps-simple.war. [exec] java.net.MalformedURLException: Bad host