persistence@glassfish.java.net

Re: How to prevent stack overflow

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Wed, 30 Aug 2006 09:19:21 +0530

Hi Gordon,

This needs to be defined in the spec( I am copying spec leads here).
Disallowing the use case would result in violation of *Liskov's
Substitution Principle* which JLS follows, allowing it may result in
surprises as that can result in *slicing*. It's a judgement call, but I
vote for allowing it as that offers more choices to users.

Thanks,
Sahoo
Gordon Yorke wrote:
> Hello Dirk,
> This error has already been detected and logged as issue 939.
> In your object model you are attempting to persist (through a
> relationship) a subclass of an Entity that is itself not an Entity.
> This is undefined by the specification and should be avoided.
> --Gordon
>
> -----Original Message-----
> *From:* Dirk Bangel [mailto:dirk.bangel_at_gmx.de]
> *Sent:* Tuesday, August 29, 2006 12:51 PM
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* RE: How to prevent stack overflow
>
> Further more information:
>
> [TopLink Fine]: 2006.08.29
> 09:48:36.156--ClientSession(6626965)--Connection(13756354)--Thread(Thread[main,5,main])--UPDATE
> SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
>
> bind => [50, SEQ_GEN]
>
> [TopLink Fine]: 2006.08.29
> 09:48:36.171--ClientSession(6626965)--Connection(13756354)--Thread(Thread[main,5,main])--SELECT
> SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?
>
> bind => [SEQ_GEN]
>
> Inserting Customer and Orders... OK
>
> [TopLink Fine]: 2006.08.29
> 09:48:36.187--ClientSession(6626965)--Connection(12524859)--Thread(Thread[main,5,main])--INSERT
> INTO TEXTENSIBLEELEMENTS (ID, operation, variable, partnerlink,
> suppressJoinFailure, faultName, name, porttype, messageExchange,
> TARGETS_ID, SOURCES_ID, CORRELATIONS_ID, TOPARTS_ID, DTYPE) VALUES
> (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
>
> bind => [1057, null, null, null, null, null, Reply, null, null,
> null, null, null, null, TReply]
>
> [TopLink Fine]: 2006.08.29
> 09:48:36.203--ClientSession(6626965)--Connection(12524859)--Thread(Thread[main,5,main])--INSERT
> INTO TEXTENSIBLEELEMENTS (ID, name, suppressJoinFailure, validate,
> TARGETS_ID, SOURCES_ID, DTYPE) VALUES (?, ?, ?, ?, ?, ?, ?)
>
> bind => [1054, Assign, null, 0, null, null, TAssign]
>
> Exception in thread "main" java.lang.StackOverflowError
>
> at
> oracle.toplink.essentials.sessions.Project.getDescriptors(_Project.java:376_)
>
> at
> oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.getDescriptors(_DatabaseSessionImpl.java:319_)
>
> at
> oracle.toplink.essentials.threetier.ClientSession.getDescriptors(_ClientSession.java:245_)
>
> In my opinion there is no recursion raising my problem!
>
> ------------------------------------------------------------------------
>
> *From:* Dirk Bangel [mailto:dirk.bangel_at_gmx.de]
> *Sent:* Dienstag, 29. August 2006 09:44
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* RE: How to prevent stack overflow
>
> Stacktrace:
>
> Exception in thread "main" java.lang.StackOverflowError
>
> at
> oracle.toplink.essentials.sessions.Project.getDescriptors(_Project.java:376_)
>
> at
> oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.getDescriptors(_DatabaseSessionImpl.java:319_)
>
> at
> oracle.toplink.essentials.threetier.ClientSession.getDescriptors(_ClientSession.java:245_)
>
> at
> oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.getDescriptors(_UnitOfWorkImpl.java:1716_)
>
> at
> oracle.toplink.essentials.internal.sessions.AbstractSession.getDescriptor(_AbstractSession.java:1242_)
>
> at
> oracle.toplink.essentials.internal.sessions.AbstractSession.getDescriptor(_AbstractSession.java:1286_)
>
> at
> oracle.toplink.essentials.internal.descriptors.ObjectBuilder.wrapObject(_ObjectBuilder.java:2285_)
>
> at
> oracle.toplink.essentials.internal.descriptors.ObjectBuilder.wrapObject(_ObjectBuilder.java:2285_)
>
> at
> oracle.toplink.essentials.internal.descriptors.ObjectBuilder.wrapObject(_ObjectBuilder.java:2285_)
>
> <<and so on>>
>
> ------------------------------------------------------------------------
>
> *From:* Dirk Bangel [mailto:dirk.bangel_at_gmx.de]
> *Sent:* Dienstag, 29. August 2006 09:39
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* How to prevent stack overflow
>
> Again me,
>
> After solving my initial problem I am getting “Stack Overflow”
> exception. Is there a “Best Practice” to be able
>
> to persist a huge bunch of java instances?
>
> -
>
> DIrk
>