Expand my Community achievements bar.

Consumer/Producer Lazy Initialize

Avatar

Level 1
Hi to all,

i'm disperate with my prblem.

I have this scenario:

1)I'm using jms/mdb ejb3 with jboss 4.2

2)I'm using FDS with Consumer/Producer comp.



My mdb



public void onMessage(Message message) {

try {





Clienti _msg = (Clienti)

((ObjectMessage)message).getObject();

System.out.println("MessageBean onMessage"

+_msg.getNome());

ClientiFacadeRemote

facade=(ClientiFacadeRemote)CachingServiceLocator.getInstance().getRemoteHome(Cl\

ientiFacade.class);

Clienti _cli=facade.findByName(_msg.getNome());

System.out.println("onMessage toString "+_cli.toString());

Clienti _cl = new Clienti(_cli);

//to queue

Send(_cl);







this my ClientFacade

@Stateless

//@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

public class ClientiFacade implements ClientiFacadeRemote {



@PersistenceContext()



private EntityManager em;

//private EntityManagerFactory entityManagerFactory =

Persistence.createEntityManagerFactory("NuovVdeUN");

//EntityManager em =
entityManagerFactory.createEntityManager();





/** Creates a new instance of ClientiFacade */

public ClientiFacade() {

}



public void create(Clienti clienti) {

em.persist(clienti);

}



public void edit(Clienti clienti) {

em.merge(clienti);

}



public void destroy(Clienti clienti) {

em.merge(clienti);

em.remove(clienti);

}



public Clienti find(Object pk) {

return (Clienti) em.find(Clienti.class, pk);

}



public List findAll() {



return em.createQuery("select object(o) from Clienti as

o").getResultList();

}



public Clienti findByName(String nome) {

Clienti _cli

=(Clienti)em.createNamedQuery("Clienti.findByNome").setParameter("nome",nome).ge\

tSingleResult();

em.clear();

return _cli;

}



}



vde.com.ejb.vo.Clienti is my EJB3 Entity with some Lazy
collection

ActionScript DTO

import mx.collections.ArrayCollection;

[Managed]

[RemoteClass (alias="vde.com.ejb.vo.Clienti")]

public class Clienti

......





I have made 30 test/example with Persistence.Extended @Steful
etc.

my last test using EntityManager.clear for detached entity...

but my ActionScript dto always try to initialize all my
collection

lazy and throws my exception "Lazy and

flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44

........



Why if my backend doesn't initiliaze some Lazy Collection why
my Flex

wonts that all lazy collection are initilaze? Pls it's a week
that i

have this problem.

I have read in www.graniteds.org (oper source alternative)
.."With

GDS, you can keep those uninitialized references with
lazy"... but how

i can doing this with Fds.

I have also download Live Cycle data beta but i have the same
problem.

Can you help me pls?

Devis



0 Replies