Hi Tom,
the constructor expression fix I checked in yesterday uses the thread
context class loader to find the constructor class. This works for
dynamic queries, but according to Sahoo this might not work for named
queries. I was wondering whether the runtime has solved this problem
already when loading the entity classes. So would it make sense to
provide an API for the query compiler allowing to access the application
class loader, such that the query compiler does not have to deal with
different call environments?
Regards Michael
> Tom Ware wrote:
>
>> Michael,
>>
>> The changes look good.
>>
>> The named queries are compiled in
>> EntityManagerFactory.createContainerEntityManager(). Most of the
>> classes we deal with at that point are from the application class
>> loader in PersistenceUnitInfo. I am not sure if using the
>> currentThread's context class loader at that point will be a problem.
>
>
> Michael, as I told you the other day, Thread's context class loader in
> the call stack of createEntityManagerFactory will be a problem. It is
> not same as application class loader.
>
> Thanks,
> Sahoo
>
>>
>> -Tom
>>
>> Michael Bouschen wrote:
>>
>>> Hi Tom, hi Shelly,
>>>
>>> attached you find a patch for two EJBQL issues:
>>>
>>> (1) An EJBQL constructor query fails in the container because the
>>> EJBQL compiler cannot find the constructor class. The same query
>>> works in a J2SE environment. I talked to Tom and Sahoo and both think
>>> using the thread context class loader should work for dynamic
>>> queries. Sahoo and I are not sure about named queries, we do not know
>>> when they are compiled and whether the context class loader is set in
>>> this environment.
>>> Tom, do you know?
>>>
>>> (2) The EJBQLParser does not accept an arithmetic expression in the
>>> SET clause of an UPDATE statement:
>>> UPDATE Employee e SET e.salary = e.salary * 10.0.
>>> I changed the corresponding rule in the EJBQLParser.
>>>
>>> The attached jar includes the changed source and the class files,
>>> such that it can be used as a patch.
>>>
>>> Tom,
>>> please have a look at the source changes.
>>>
>>> Shelly,
>>> please try the patch and let me know whether it works on your side.
>>>
>>> Thanks!
>>>
>>> Regards Michael
>>>
>>>
>>>
>>>
>>
>