webtier@glassfish.java.net

Hot to persist an injected object ?

From: <webtier_at_javadesktop.org>
Date: Mon, 10 May 2010 04:11:10 PDT

Hi,

I wan't to persist an injected object that is bound to a JSF page:

public class Registration {

    @Inject
    Customer customer;

    public void register() {

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("RegAppPU");
        EntityManager em = emf.createEntityManager();
        em.persist(customer);
        em.getTransaction().commit();

    }

The problem ist, that the injected customer object is not a Customer class but a Customer_$$_javassist_17 class. Because of that I get an error when I try to persist the customer object.

Since I just started with Glassfish and EE6 I'm probably doing something completely wrong or is this the expected behaviour ?

Regards
  Roger
[Message sent by forum member 'roger_gl']

http://forums.java.net/jive/thread.jspa?messageID=469190