persistence@glassfish.java.net

Re: The latest changes to MetadataProcessor?

From: Tom Ware <tom.ware_at_oracle.com>
Date: Fri, 20 Oct 2006 13:36:30 -0400

I am happy to do whatever is easiest for you.

Just let me know if you want me to check in the changes or not.

-Tom

Marina Vatkina wrote:

>I'm changing this file in another place. Should I fix this or would you
>prefer to do it on your side?
>
>thanks,
>-marina
>
>Tom Ware wrote:
>
>
>>Sure
>>
>>Marina Vatkina wrote:
>>
>>
>>
>>>Hi Tom,
>>>
>>>Will it make sense to add these explanations at the comments?
>>>
>>>thanks,
>>>-marina
>>>
>>>Tom Ware wrote:
>>>
>>>
>>>
>>>
>>>>Hi Marina,
>>>>
>>>>Comments inline:
>>>>
>>>>Marina Vatkina wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Hi Tom,
>>>>>
>>>>>The new code seems to have several problems:
>>>>>
>>>>> if (m_session == null){
>>>>> AbstractSessionLog.getLog().log(SessionLog.CONFIG,
>>>>> SessionLog.EJB_ORM,
>>>>> EntityManagerSetupImpl.ERROR_LOADING_XML_FILE,
>>>>> e);
>>>>>1. Look below, the same message takes 2 args - which one is correct?
>>>>>
>>>>> } else if (!throwException) {
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>I will update the new code to include the "mf" string. Thanks for
>>>>the hint.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>2. Why m_session == null should never throw an exception?
>>>>>
>>>>> // fail quietly
>>>>> m_session.log(SessionLog.CONFIG,
>>>>> SessionLog.EJB_ORM,
>>>>> EntityManagerSetupImpl.ERROR_LOADING_XML_FILE,
>>>>> new Object[] {mf, e});
>>>>> } else {
>>>>> // fail loudly
>>>>> m_session.handleException(e);
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>This code is hit in PersistenceUnitProcessor before a session is
>>>>available. It uses MetadataProcessor to generate a list of classes
>>>>from the ORM XML files when running is SE mode. I do not want the
>>>>whole application to stop at this point if there is an exception. In
>>>>fact, if there is an issue with loading these ORM XML files, they
>>>>will be hit again later when the metadata processing step is hit in
>>>>the predeploy logic. At that point the session will handle it.
>>>>(Note: Session.handleException() does more than just throw the
>>>>exception)
>>>>
>>>>-Tom
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>thanks,
>>>>>-marina
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>
>>

-