users@glassfish.java.net

Re: When using _at_PersistenceContext deploying returns a string index out of rang

From: <glassfish_at_javadesktop.org>
Date: Wed, 12 Sep 2007 01:18:57 PDT

ok so if i understood your advice correctly then I need to create and persist an entity class in my session bean?

I tried this but then i still get the same error msg

[code]
package byelex.advisor.webbased_designer.kb_beans;

import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author kaas
 */
@Stateless
@WebService
public class NewSessionBean implements NewSessionRemote {
    @PersistenceContext
    private EntityManager em;
    
    /** Creates a new instance of NewSessionBean */
    public NewSessionBean() {
    }

    public String helloWorld() {
        NewEntity ne = new NewEntity();
        em.persist(ne);
        return "Hello World";
    }
}
[/code]
[Message sent by forum member 'johnnyvdlaar' (johnnyvdlaar)]

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