NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Problem with Entity Manager

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
harini19



Joined: 29 Apr 2009
Posts: 28
Location: India

PostPosted: Wed May 06, 2009 9:50 am    Post subject: Problem with Entity Manager Reply with quote

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
Back to top
michael
Posted via mailing list.





PostPosted: Wed May 06, 2009 2:00 pm    Post subject: Problem with Entity Manager Reply with quote

If you're using glassfish (or any other application server), you normally don
Back to top
harini19



Joined: 29 Apr 2009
Posts: 28
Location: India

PostPosted: Thu May 07, 2009 8:38 am    Post subject: Problem with Entity Manager Reply with quote

I'm attaching the codes here. Pl look


TbdbUsertable.java
 Description:
Entity class for the table

Download
 Filename:  TbdbUsertable.java
 Filesize:  4.07 KB
 Downloaded:  68 Time(s)

Back to top
harini19



Joined: 29 Apr 2009
Posts: 28
Location: India

PostPosted: Thu May 07, 2009 8:42 am    Post subject: Problem with Entity Manager Reply with quote

I'm attaching files


Error.txt
 Description:
Error

Download
 Filename:  Error.txt
 Filesize:  5.07 KB
 Downloaded:  89 Time(s)


TableBean.java
 Description:
Backing Bean

Download
 Filename:  TableBean.java
 Filesize:  3.36 KB
 Downloaded:  65 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo