You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Fabio Oliveira <fa...@gmail.com> on 2010/02/12 19:11:55 UTC

Why did @Stateful create tables, but @Steteless didn't?

Hi list!

I started to learn how to do unit tests using OpenEJB. To make the
things easy, I started to change one of the examples, the
jpa-eclipselink. My requisites include use JPA 2.0, and I made this
change without problems. But I need to populate the database before
the tests, and I use for this task the DBUnit, and everything ran ok.
But finally, when I tried to change the EJB scope, from @Stateful to
@Stateless, the tables wasn't created by eclipselink!

I changed:

@Stateful(name="SecurityContext")
public class TrimboxSecurityContextBean implements SecurityContext {

    @PersistenceContext(unitName= "seguranca",
type=PersistenceContextType.EXTENDED)
    private EntityManager repositorio;

To:

@Stateless(name="SecurityContext")
public class TrimboxSecurityContextBean implements SecurityContext {

    @PersistenceContext(unitName= "seguranca")
    private EntityManager repositorio;


Maybe is a naive mistake, but I couldn't saw the differences. Why the
change of scope influence the table generation by EclipseLink? Anyone
can help?

I'm sending the code attached, any help will be appreciated. Thanks!



-- 
Fábio Braga de Oliveira
Facebook: http://pt-br.facebook.com/fboliveira?p
LinkedIn: http://www.linkedin.com/in/fabiobragaoliveira
Blog: http://www.architecteam.com.br/people/fabio/blog