Trouble with copying an object

I am trying to copy an object as follows:
First, I read the object (using the session not in a Unit of Work)
then, I modify the primary key
Finally I do a registerNew.
The result is a duplicate primary key error. I can examine the object that I am regisering as a new object and it does have the new key, but when I look at that SQL INSERT statement that is geting generated still has the old key.
I tried experimenting with the undocumented copyObject methods, but it still had the same problem. Any suggestions on what I am doing wrong.
Thanks,
JJ

Doug,
I have a related problem with copying. basically, I need to create a copy of an object for display to an HTML page. The user can then submit multiple changes. Once he/she decides it is good, a commit occurs. I was planning to use the copyObject() (using ClientSession) at the beginning and the mergeClone() before finally issuing commit() on the UnitOfWork.
The object that I'm working with has multiple levels embedded in it, such as
class1
+--- class2(multiple)
+--- class3 (multiple)
+--  class4(single)
If the object has references to non-private parts, how do prevent the copyObject() and the mergeClone() methods from going out of control and recursively trying to create clones. I'm asking because when the copy or merge is not limited to private parts, TopLink seems to want to copy/merge everything. Some of our tables have reverse references to other objects so the whole thing becomes one endless loop.
any help would be appreciated...
charlie

Similar Messages

  • I'm in trouble with copy paste some text from Word to DW mx 2004

    I'am a new developer in webdesign. I'm doing my first site to
    a cliente. I'm in trouble with copy paste some text from Word to DW
    mx 2004. In the Edit / Preferences / General category i have the
    spelling dictionary in Portuguese (Brasilian). If I wrote the text
    in Portuguese directly from DW i can see the letters with ( ç
    ã é ... ) and in the browser testing ( IE 6.0.2 with sp2
    and FireFox 1.0.7 ), but with copy paste from the text in Word in
    Portuguese when i bring it to DW i can see the ( ç ã
    é ... ) in the beginnig but in the Browsers testing i can't,
    and then after a while i lose the ( ç ã o ...). Can
    anyone help me !?
    I need the work finish in next monday. Thanks a lot.

    Your line breaks will most likely be incorrect if you don't turn on the Japanese Composer.
    It is almost absolutely impossible to accomplish your goal without having a font - any font - installed on your system that has that glyph. However, if it's showing up in Word, than means that you must have that glyph installed, right? What font are you trying to use in InDesign? You might already know that Word will auto-substitute fonts when it encounters a missing glyph, so we really don't know what font is being used to render that one glyph. The whole sentence might be in MS Mincho but one glyph might be pulled from another font if MS Mincho doesn't have that glyph.
    That being said, you're going to break it if you don't know how to set Japanese type in ID. It's not something where you can just copy text out of email and paste into your English layout.

  • Problem with Copied Business Object : SELFITEM

    Hi,
    sub:    Problem with Copied Business Object : SELFITEM
    I want to use changed selfitem BOR for carbon copy functionality. For it, i copied the BOR : SELFITEM. it is giving error
    In SWI2_DIAG it is showing like this.
    Work item  cannot be read                                                
    Work item 000000639770: Object  method SWW_BI_EXECUTE_S cannot be executed
    The problem is with COPYING The Business Object. Because , generally we extend BOR ,not copy. But i did copy.
    Please help me regarding this.
    Balaji.T.

    hi Martin,
    The problem may not be in method. because simply we copied the BO:SELFITEM into ZSELF . And i want to test this for a mail at first , whether copied BOR  is working or not.The mail is not triggering . it is saying that it is Error.
    WF_BATCH error...
    I can see error in Tx: SWI2_DIAG ,
    this is Error :
    Work item 000000639770: Object  method SWW_BI_EXECUTE_S cannot be executed
    Once it is rectified i can modify the method in BO:ZSELF.
    Thank you in Advance..
    Balaji.T.

  • Margin trouble with a Flash object in Dreamweaver.

    Hi everyone,
    I am having trouble with the top and bottom margins of a banner created in Flash and then inserted into Dreamweaver. I thought I had done the proper zero margin adjustments, I usually use IE8 and everything looked fine.
    However, when viewing the page with IE in some (not all) other computers a red (background color) line appears accross the white frame at the top and another one interrupting the shadow at the bottom of the banner. Not sure whether the difference was the IE version or a question of settings.
    Any ideas as to what may be causing this problem and how I to solve it?
    Also, in Safari and Chrome everything looks good, but with Firefox (version 3.5.1) for some reason the white bottom margin within the banner's frame is bigger than the top. Not as big a deal as the first problem, but I guess they are probably related.
    Here is the link to the page in question: http://www.migtraducciones.com.ar/who_we_are.html
    Thanks in advance for any helpful hints.
    Regards,
    Eduardo.

    Thanks for your answer.
    I mean that I can't find the folder to authorize. I will be more clear: this is the dialog box (it's in italian, but you all know what is about).
    How can I tell Flash Player to authorize the iWeb widget folder if I can't find it in my Mac?
    I'm under Mac, OS X 10.6.7.

  • Trouble with Copy and Paste

    Im using captivate 7 and when editing a slide element such as atext caption, image or anything really, I cannot copy and paste an item. It makes a sound when I try command C but does nothing. Right click shows options only for slide but nothing for copy options.

    Hi there,
    Are you trying to copy/paste a Title/Subtitle Placeholder or a normal Text caption? Can you please post a screenshot of the object's Right Click menu so that we can understand the issue better?
    Thanks,
    Nimmy Sukumaran.

  • Trouble with multi state object

    How do i build a graphic step by step with the previous state still showing?

    You add the previous state to the next one and keep building it that way.
    Bob

  • Problem with copy of the object

    Hi,
    trying to copy (clone) my object:
    var a:TestObj = new TestObj()
    var a2:TestObj = ObjectUtil.copy( a ) as TestObj;
    but i recieve nothing. So the ObjectUtil.copy can return me
    only the Object type, but i want a concrete type!!!
    Is it possible?

    It seems your dealing with request scoped object(s). So you should be safe with respect to the multiple threads.

  • I'm having trouble with custom ringtones.  I have downloaded the free software "makeTones" and have created some ringtones.  I then copied those to Mac and played them in ITunes.  My Itunes does not have a ringtone tab.  I can not sync the ringtones.

    I'm having trouble with custom ringtones.  I have downloaded the free software "makeTones" and have created some ringtones.  I then copied those to Mac and played them in ITunes.  My Itunes library does not have a ringtones tab.  I can not sync the ringtones (or I don't know how)!  Please help.

    Yes, the file extension is M4R.  Does it matter where I save these files on my Macbook?  I then opened them in Itunes and played them.  I did find the Tones folder in Itunes but the Tones or Ringtones tab does not show up when I select Iphone (within Itunes).  When I open the Tones folder in the Library, it is empty.  Thanks in advance for your help.

  • How to copy an Object with sequencing primary key?

    Hi, I have a use case here to copy all the informations and create a new object? The draft process i am using is:
    obj original = session.readObject;
    obj target = uow.readObject;
    if(target is not there) {
    target = uow.registerObject(new target())
    target.attrA = original.attrA
    target.attrZ = original.attrZ}
    uow.commit;
    It works fine, but i don't like to repeat the boring attribute copying. So i change my code to:
    obj original = session.readObject;
    obj target = uow.readObject;
    if(target is not there) {
    original.pk = null;
    uow.registerNewObject(original);
    uow.commit;
    I try to set the pk of the original to null and let it to use the sequence one. However, It fails with an exception that the primary key cannot be null. Is there anybody can help me to simplify the process? Any concerns or comments are really appreciated.
    Message was edited by:
    juwen

    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

  • Having trouble with creating objects from instances created with ClassLoade

    Hi.
    I'm having a bit of trouble with casting an instance of an object from a custom ClassLoader. Don't worry - the code isn't for anything sinister - it's for one of those life simulation thingies, but I want to make it modular so people can write their own 'viruses' which compete for survival. You know the score.
    Anyway. I've got the beginnings of my main class, which seems to load the class data for all 'virus' classes in a folder called 'strains'. There is a abstract class called AbstractVirus which declares the method calls for how the viruses should behave and to get textual descriptions, etc. AbstractVirus is to be subclassed to create working virus classes and these are what my main class is trying to load instances of.
    Unfortuantely, I can't cast the instances into AbstractVirus objects. The error I've been getting is 'ClassCastException' which I presume is something to do with the fact that my ClassLoader and the Bootstrap ClassLoader aren't seeing eye-to-eye with the class types. Can anyone help? This line of programming is really new to me.
    My code for the main class is below:
    /* LifeSim.java */
    public class LifeSim {
      public LifeSim() {
        /* Get a list of all classes in the 'strains' directory and store non-
         * abstract classes in an array. */
        Class virusClasses[] = null;
        try {
          /* Get a reference to the file folder 'strains' and make sure I can read
           * from it. */
          java.io.File modulesFolder = new java.io.File("strains");
          if (!modulesFolder.isDirectory() || !modulesFolder.canRead()) {
         System.out.println("Failed to find accessible 'strains' folder");
         System.exit(-1);
          /* Get a list of all the class files in the folder. */
          String virusFiles[] = modulesFolder.list(new ClassFileFilter());
          if (virusFiles.length == 0) {
         System.out.println("No virus strains in 'strains' folder");
         System.exit(-1);
          /* Create an array of class objects to store my Virus classes. Ignore the
           * abstract class as I cannot instantiate objects directly from it.*/
          virusClasses = new Class[virusFiles.length];
          VirusClassLoader classLoader = new VirusClassLoader();
          int j = 0;
          for (int i = 0; i < virusFiles.length; i++) {
         String virusName = "strains/" + virusFiles;
         Class tempClass = classLoader.loadClass(virusName);
         if (tempClass.getName().compareToIgnoreCase("strains.AbstractVirus") != 0) {
         virusClasses[j++] = tempClass;
    } catch (ClassNotFoundException ncfe) {
    System.out.println("Failed to access virus class files.");
    ncfe.printStackTrace();
    System.exit(-1);
    /* TEST CODE: Create an instance of the first virus and print its class
    * name and print details taken from methods defined in the AbstractVirus
    * class. */
    if (virusClasses.length > 0) {
    try {
         // Print the class name
         System.out.println(virusClasses[0].getName());
         Object o = virusClasses[0].newInstance();
         strains.AbstractVirus av = (strains.AbstractVirus) o;
         // Print the virus name and it's description
         System.out.println(av.getQualifiedName());
         System.out.println(av.getDescription());
    } catch (InstantiationException ie) { ie.printStackTrace(); }
         catch (IllegalAccessException iae) { iae.printStackTrace(); }
    public static void main(String args[]) {
    new LifeSim();
    class ClassFileFilter implements java.io.FilenameFilter {
    public boolean accept(java.io.File fileFolder, String fileName) {
    if (_fileName.indexOf(".class") > 0) return true;
    return false;
    class VirusClassLoader extends ClassLoader {
    private String legalClassName = null;
    public VirusClassLoader() {
    super(VirusClassLoader.class.getClassLoader());
    public byte[] findClassData(String filename) {
    try {
    java.io.File sourcefile = new java.io.File(filename);
    legalClassName = "strains." + sourcefile.getName().substring(0,sourcefile.getName().indexOf("."));
    java.io.FileInputStream fis = new java.io.FileInputStream(sourcefile);
    byte classbytes[] = new byte[fis.available()];
    fis.read(classbytes);
    fis.close();
    return classbytes;
    } catch (java.io.IOException ioex) {
    return null;
    public Class findClass(String classname) throws ClassNotFoundException {
    byte classbytes[] = findClassData(classname);
    if (classbytes == null) throw new ClassNotFoundException();
    else {
    return defineClass(legalClassName, classbytes, 0, classbytes.length);
    Thank you in advance
    Morgan

    Two things:
    I think your custom ClassLoader isn't delegating. In general a ClassLoader should begin by asking it's parent ClassLoader to get a class, and only if the parent loader fails get it itself. AFAIKS you could do what you're trying to do more easilly with URLClassLoader.
    Second, beware that a java source file can, and often does, generate more than one class file. Ignore any class files whose names contain a $ character. It's possible you are loading an internal class which doesn't extend your abstract class.

  • I am having troubles with 3 things: scrolling with my laptop mouse, controlling my laptops volume with F9 and F10 keys, and I can not copy and paste images.

    I am having troubles with 3 things: scrolling with my laptop mouse, controlling my laptops volume with F9 and F10 keys, and I can not copy and paste images.

    Hello,
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    volume controls issues are windows, not firefox.
    How your copy and paste your image? from where to where

  • Troubles with save object in request

    Hi All!
    I have trouble with saving EditCurrentRecord in request. In JDeveloper everything works fine. But when I try to run on iAS with Apache/Jserv I get jsp compilation error:
    java.lang.NoSuchMethodError: javax.servlet.ServletRequest: method setAttribute(Ljava/lang/String;Ljava/lang/Object;)V not found
    I have this problem with a lot of my pages.
    First time I thinks problem is in my code. By after removing every line of my custom code and leaving only JD code, I get the same error. Some pages works fine, another no! They are looks very simillary.
    I also take a look at servlet code. It's look great.
    Anybody have this problem?
    null

    Hi Dev,
    Please check the FG 'STRD', it should have FM for your requirement.
    Like FM 'TR_OBJECT_INSERT' or TR_OBJECTS_INSERT etc.
    Best Regards,
    Swanand

  • Copying form objects with subclass info

    In Forms 6i, is there any way to copy form objects (blocks, items, canvases, etc.) from one form to another with original subcalss information.
    When tried copying, it copies all form objects but subclass information is lost. If we try to do referencing, then it changes subclass references to the source form (i.e., references to original template object library are lost).
    Regards,
    Sanjiv

    I'm sorry, but i don't have any forms 6i-installation and its a long time since i last user it. So i don't know if its possible or not.
    There is one way to make it faster than using the property-palette. You can make an object in your object-library as "Smartclass". Then you can apply the object-class using the right mouse in the layout editor and simply apply that smartclass frm the context menu.

  • TS1292 i am having trouble with my prometheus digital copy code

    i am having trouble with my prometheus digital copy code being invalid, i have tried opening media manager II.exe but it say it is not compatible with osx what do i do now

    my Blue ray DVDs have no mediamanager programs on...
    I don't have a digital copy DVD. I bought a 4 disc blue ray collection BD with 3x blue ray (3d, movie in 2d and bonus) and a DVD copy.).
    It doesn't have a digital copy disc, it only has a ticked saying it is a digital copy code, which has only links to ultraviolet ****** service.
    I want to have it in itunes....
    any help?
    Also.
    Why can I buy a DVD or a music CD in foreign country amazon store, and I can't buy those music CDs in itunes in other country?
    I mean, amazon now offers you a mp3 copy of all CDs you bought over them, so.....why not apple??

  • I AM TRYING TO DOWNLOAD A FRESH COPY OF CS6 BUT HAVING TROUBLE WITH MY SERIAL NUMBER

    I AM TRYING TO DOWNLOAD A FRESH COPY OF CS6 BUT HAVING TROUBLE WITH MY SERIAL NUMBER?

    Hi Rob,
    Please share few more details about the issue you facing.
    Which Operating system you have?
    Which product are you using?
    What exact error message/code you get?
    Thanks,
    Ratandeep Arora

Maybe you are looking for

  • Equium A60 screen blackout but an image is still visible

    Purchased this laptop as it was supposed to be reliable. After 18 VERY basic use the screen started to black intermittently until 3 months ago it failed completely; I now use an external flat screen(had that for 4 years! no problem). Now I have notic

  • Photos turning red with Ken Burns

    When I apply Ken Burns effect, the photos turn red. Like a transparent layer of red overlay on top of the photo. any ideas what I'm doing wrong? I formatted them in a jpg format.

  • ASA 5520 Not Failing over

        Hi All Im preparing a lab and I have 2 ASA 5520's. I have configured them for failover so the Primarys config will replicate over to the Secondary. They are connected via a 3560 switch. the switch ports are configured as access ports on vlan 1. S

  • SCEP definition update through Automate Deployment Rule

    Hi all.  Got a question on deploying SCEP 2012 definition updates to client PC through SCCM2012 R2 by using Automate Deployment Rule.  It looks like the client PC is not receiving the definition updates immediately.  The ADR seems working fine, it co

  • Duplicate field name in ResultSet

    Hi! I have a ResultSet which fetches data from Oracle Database with the following Select statement Select a.id, a.title, b.title from article a, event b where a.eventid=b.id; The problem is when I fire the command getString("title") of the resultset