tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Oliveira <fabio.br...@gmail.com>
Subject Why did @Stateful create tables, but @Steteless didn't?
Date Fri, 12 Feb 2010 18:11:55 GMT
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

Mime
View raw message