Since yours is a read-only method, you can easily work around this by problem by simply detaching the objects before returning from the function:
*em.clear();* // detach all the entities, so updates won't go to database
return list;
Thanks,
Sahoo
glassfish_at_javadesktop.org wrote:
> Sahoo
>
> Here is my stateless Session Bean
>
>
> @Stateless
> @WebService
> public class ValidAppStatusFacade implements ValidAppStatusFacadeLocal {
>
> @PersistenceContext
> private EntityManager em;
>
> /** Creates a new instance of ValidAppStatusFacade */
> public ValidAppStatusFacade() {
> }
>
>
> public List findAll() {
>
> List list = (List)em.createQuery("select object(o) from ValidAppStatus as o").getResultList();
> for(Iterator<ValidAppStatus> i = list.iterator(); i.hasNext(); ){
> ValidAppStatus validApp = i.next();
> for(Application application:validApp.getApplicationCollection()){
> application.applicationStatus = null; //break cycle -- How do i detach applicationSttaus from application
> }
> }
> return list;
>
> }
> }
>
> Sorry, how can i detach applicationStatus in the above method.
>
> Thanks
> [Message sent by forum member 'ad1900' (ad1900)]
>
> http://forums.java.net/jive/thread.jspa?messageID=240705
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>