persistence@glassfish.java.net

Re: class cast exception during persist

From: jeff <jeffrey.blattman_at_yahoo.com>
Date: Wed, 14 Mar 2007 15:05:12 -0700 (PDT)

please disregard, my mistake.

jeff <jeffrey.blattman_at_yahoo.com> wrote: i am having a very strange problem where i am getting class cast exceptions during a persist operation. this happens in the equals() method of by object (see stack trace below). there are also a few warnings during the schema generation. i do not know if this is related.

just to verify there's no mistake in the implementation of equals(), i did just do an:

foo.equals(foo))

test, which had no problems.

any ideas? i can provide the source, or the entire project if that will help.

Running com.sun.portal.pom.PersistTest
[TopLink Info]: 2007.03.14 01:48:53.039--ServerSession(12887532)--TopLink, version: Oracle TopLink Essentials - 2.0 (Build 36 (02/17/2007))
[TopLink Info]: 2007.03.14 01:48:54.228--ServerSession(12887532)--file:/Users/jtb/src/pom/target/test-classes/-pomtest login successful
[TopLink Warning]: 2007.03.14 01:48:55.087--ServerSession(12887532)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build 36 (02/17/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ALTER TABLE failed. There is no constraint 'APP.CNTNRCNTNRCNTNRTYP' on table 'APP.CONTAINER_CONTAINERPREFERENCE'. Error Code: -1
Call:ALTER TABLE CONTAINER_CONTAINERPREFERENCE DROP CONSTRAINT CNTNRCntnrCNTNRTYP
Query:DataModifyQuery()
[TopLink Warning]: 2007.03.14 01:48:56.767--ServerSession(12887532)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build 36 (02/17/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Constraint 'CNTNRCNTNRCNTNRTYP' already exists in Schema 'APP'.Error Code: -1
Call:ALTER TABLE CONTAINER_CONTAINERPREFERENCE ADD CONSTRAINT CNTNRCntnrCNTNRTYP FOREIGN KEY (Container_CONTAINER_TYPE) REFERENCES CONTAINER (CONTAINER_TYPE)
Query:DataModifyQuery()
java.lang.ClassCastException: com.sun.portal.pom.Container
        at com.sun.portal.pom.Preference.equals(Preference.java:60)
        at oracle.toplink.essentials.internal.helper.IdentityHashtable.contains(IdentityHashtable.java:167)
        at oracle.toplink.essentials.mappings.ObjectReferenceMapping.cascadeRegisterNewIfRequired(ObjectReferenceMapping.java:653)
        at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.cascadeRegisterNewForCreate(ObjectBuilder.java:1256)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3212)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:190)
        at com.sun.portal.pom.PersistTest.persistPortletEntity(PersistTest.java:65)


     

---------------------------------
Looking for earth-friendly autos?
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.

 
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.