Hello,
If you have not done so already please create a bug for this issue in the Glassfish issue tracker. If you are unable to do so please let me know and I will enter one on your behalf.
--Gordon
-----Original Message-----
From: Edson Carlos Ericksson Richter
[mailto:edson.richter_at_mgrinformatica.com.br]
Sent: Monday, June 12, 2006 7:45 AM
To: users_at_glassfish.dev.java.net
Subject: Re: Persistence problem without helpful message
I could (finally!) find the broken mapping. I expect you could fix it
better knowing what was wrong:
Erroneous mapping:
@OneToMany(cascade = CascadeType.ALL, mappedBy =
"artigoPredicativoPrecoList")
private java.util.Collection
<br.com.fortuna.combineit.entity.ArtigoPredicativo> predicativoList;
wrong mapped to:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "predicativoPreco")
private java.util.Collection <br.com.fortuna.combineit.entity.Artigo>
artigoPredicativoPrecoList;
and corrected to:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "artigo")
private java.util.Collection
<br.com.fortuna.combineit.entity.ArtigoPredicativo> predicativoList;
correctly mapped to:
@ManyToOne
private Artigo artigo;
The issue is the verifier should point the error (can't map a OneToMany
pointing to another OneToMany).
Thanks,
Richter
Edson Carlos Ericksson Richter escreveu:
> Hi!
>
> Converting a project from Hibernate to JPA, I got several classes
> annotated (they was xml based mapping).
> Everything goes fine until last night, when I run refactor (in real,
> renamed) several fields and methods using latest NB 5.5 (200606090200).
> The code compiles perfectly (Clean and Build all), but I can't deploy.
> I'm getting an error every time run verifier (or when I deploy -
> comments continue bellow this stack trace):
>
>
> com.sun.enterprise.tools.verifier.tests.persistence.DefaultProviderVerification
>
> java.lang.ClassCastException:
> oracle.toplink.essentials.mappings.OneToManyMapping
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processOneToMany(MetadataProcessor.java:1346)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.annotations.EJBAnnotationsProcessor.processOneToMany(EJBAnnotationsProcessor.java:1487)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processRelationshipAccessor(MetadataProcessor.java:1643)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.annotations.EJBAnnotationsProcessor.processRelatedEntity(EJBAnnotationsProcessor.java:1786)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.annotations.EJBAnnotationsProcessor.processORAnnotations(EJBAnnotationsProcessor.java:1543)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:405)
>
> at
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:156)
>
> at
> com.sun.enterprise.tools.verifier.tests.persistence.DefaultProviderVerification.check(DefaultProviderVerification.java:80)
>
> at com.sun.enterprise.tools.verifier.CheckMgr.check(CheckMgr.java:120)
> at
> com.sun.enterprise.tools.verifier.persistence.PersistenceUnitCheckMgrImpl.check(PersistenceUnitCheckMgrImpl.java:83)
>
> at
> com.sun.enterprise.tools.verifier.CheckMgr.checkPersistenceUnits(CheckMgr.java:377)
>
> at
> com.sun.enterprise.tools.verifier.web.WebCheckMgrImpl.check(WebCheckMgrImpl.java:69)
>
> at
> com.sun.enterprise.tools.verifier.BaseVerifier.verify(BaseVerifier.java:133)
>
> at
> com.sun.enterprise.tools.verifier.web.WebVerifier.verify(WebVerifier.java:79)
>
> at
> com.sun.enterprise.tools.verifier.VerificationHandler.runVerifier(VerificationHandler.java:223)
>
> at
> com.sun.enterprise.tools.verifier.VerificationHandler.verifyArchive(VerificationHandler.java:134)
>
> at
> com.sun.enterprise.tools.verifier.Verifier.verify(Verifier.java:131)
> at com.sun.enterprise.tools.verifier.Verifier.main(Verifier.java:101)
>
>
>
> PS: the error line number (1346) don't match to any released source
> code I've found on CVS (most close I got was a empty line or a comment
> line)!
> As far as I could track, the problem is with OneToMany mappings, but
> there is no error treatment on the referred method, and there is no
> attribute reference on the stack trace.
> If this is a unknown issue, I'll add it on bug database, because I
> can't evolute, neither can find cause, blocking completely further
> progress.
> The code causing problem is pretty complex and closed, so I can't
> share with community, but I'll be happy to help debug/fix it.
> IMHO, a try-catch, correctly put in the method could lead to a clear
> understanding where the problem is.
>
> Thanks,
>
> Richter
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net