users@glassfish.java.net

Re: ClassCastException when using JPA result

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Tue, 19 Aug 2008 23:57:39 -0400

Thank you for responding. Based on what I pasted in the forum post (see
link), what am I doing wrong?

I see the bean defs for entityManagerFactory:

<property name="loadTimeWeaver">
     <bean
class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
</property>

This is the first time I try to use JPA with Spring.


Thanks,
Ryan


Marina Vatkina wrote:
> Ryan,
>
> This is usually caused by weaving. If you have your entities weaved on
> the server (e.g. to support LAZY loading), you need to have them
> weaved either dynamically (ACC would do that) or statically (i.e.
> you'd need to modify/repackage the client side jar) yourself.
>
> Regards,
> -marina
>
> Ryan de Laplante wrote:
>> I loading a JPA entity from my POJO DAO that uses @PersistenceContext
>> and @Transactional from Spring 2.5. The result that is returned has
>> the same name (ex: com.company.app.dao.SettingsEntity) but I get a
>> class cast exception when I try to cast from Object to the entity
>> bean class so that I can use it. I wrote more details here:
>>
>> http://forum.springframework.org/showthread.php?t=58964
>>
>> I'm wondering if this is a JPA issue, not Spring?
>>
>>
>> Thanks,
>> Ryan