DeepCopy problems with dissolved proxy

Discussion in 'Java' started by horst, Jan 16, 2007.

  1. horst

    horst Guest

    Hey!
    I get myself construct me from data base entries an object structure.
    And make one deepcopy from this object structure. So far so well.
    The problem is in the copied object structure not all proxys are
    dissolved.


    That is, with accessed the dissolved objects, I get a big bang.

    Do you know about a solution to dissolved the proxy before or during
    the deepcopy?

    My persistence framework is hibernate!

    ....
    public abstract class HibernatePersistentDomainObject implements
    HibernatePersistentDomain, Serializable{
    ....
    public static Object deepCopy()
    {
    try{
    ByteArrayOutputStream myBAOutputStream = new
    ByteArrayOutputStream();
    new ObjectOutputStream( myBAOutputStream ).writeObject( this
    );
    ByteArrayInputStream myByteArrayInputStream = new
    ByteArrayInputStream( baos.toByteArray() );
    return new ObjectInputStream(myByteArrayInputStream
    ).readObject();
    }
    catch(Exception e){
    ServerLog.error("DeepCopy failed!");
    return null;
    }

    }
    }
    .......................

    horst
    horst, Jan 16, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    615
  2. Eugeni Doljenko

    Legitimacy of deepcopy

    Eugeni Doljenko, Jun 4, 2004, in forum: Python
    Replies:
    2
    Views:
    317
    David Bolen
    Jun 7, 2004
  3. Donnal Walter

    deepcopy in new-style classes

    Donnal Walter, Jun 22, 2004, in forum: Python
    Replies:
    0
    Views:
    261
    Donnal Walter
    Jun 22, 2004
  4. OKB (not okblacke)

    deepcopy raises TypeError for method/function?

    OKB (not okblacke), Sep 9, 2004, in forum: Python
    Replies:
    3
    Views:
    390
    Alex Martelli
    Sep 10, 2004
  5. Dan Perl
    Replies:
    0
    Views:
    321
    Dan Perl
    Sep 14, 2004
Loading...

Share This Page