What is the exception. It seems that you are unable to create an
EntityManager at all because of a configuration issue.
--Gordon
Skanda skanda wrote:
> I'm using netbeans 6.5, glassfish,persistence and mySQL. I'm not able
> to check whether EntityManager is open or not. Here is the code:
> {code}
> private String getData1() {
> try {
> em=javax.persistence.persistence.createEntityManagerFactory("x").createEntityManager;
>
> if (em.isOpen())
> {
> return("open");
> }
> else
> {
> return("close");
>
> }
>
> } catch (Exception nre) {
> System.out.println(nre);
> return null;
> }
>
> }
> {code}
>
> but it returns with the error unable to instantiate Entity Manager
> class. I've @PersistentContext included in the java file. What else to
> be added here? Or how do I open EntityManager