Results 1 to 2 of 2
- 08-19-2011, 08:28 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 1
- Rep Power
- 0
I can't use Entity Class (JPA) in Netbeans7.0 .
I tried to use Entity Class (JPA) in Netbeans7.0 but It doesn't work.
1. I create Enterprise Application name BookApp.
Create Entity Class
2. I right click at BookApp-ejb and select Entity Classes fron Database.
3. In dialog New Entity Class from Database I insert JNDI Name:jdbc/test for connect to test database and select table books. After that ,I click Next for insert Package: entity and click Finish.
Create Session Bean
4. I right click at BookApp-ejb and select Session Beans for Entity Classes and click Next.
5. I click Add All >> and click Next.
6. I insert Package: sb , create Interface:Local and click Finish.
Create Web Application
7. I right click BookApp-war and select HTML insert HTML File Name :findBook and click Finish.
8. I put this code in HTML file
9. I right click BookApp-war and select Servlet insert File Name: ShowBook, Package: servlets and click Finish.Java Code:<form action="ShowBook" method="POST"> <h2>Search Book from ISBN </h2> Enter ISBN <input type="text" name="isbn" value="" /> <input type="submit" value="Find" /> </form>
10. I right click in editor and select Insert Code… > Call Enterprise Bean…
11. In dialog Call Enterprise Bean I select BooksFacade and click OK.
12. I uncomment html and insert this code between out.println("<body>");
13. I clean and build BookApp.Java Code:String isbn = request.getParameter("isbn"); Books book = booksFacade.find(isbn); out.println("Title: " + book.getTitle()+ "<BR>"); out.println("Author: " + book.getAuthor() + "<BR>"); out.println("Price: " + book.getPrice() + "<BR>");
14. I run BookApp.
15. I go to this URL http://localhost:8080/BookApp-war/findBook.html and insert isbn from books table but when I click Find button It show error like this.
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.ejb.EJBException
I don't know what I mistake. I delete Session Beans and create Session beans again but no create Interface. when I run BookApp it show same error. I'm new for EJB. please help me.
- 08-19-2011, 10:56 AM #2
Similar Threads
-
error in creating the entity class by netbeans
By javastuden in forum NetBeansReplies: 2Last Post: 07-22-2011, 01:29 PM -
jpa entity update
By videanuadrian in forum Advanced JavaReplies: 14Last Post: 06-14-2011, 04:18 PM -
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping project
By Ed in forum JDBCReplies: 4Last Post: 05-13-2011, 10:04 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks