users@glassfish.java.net

can not fetch data on GlassFish v3 Prelude(EclipseLink)

From: <glassfish_at_javadesktop.org>
Date: Tue, 25 Nov 2008 17:40:36 PST

I am using a test sample from Java EE tutorial called bookstore. Below is my env.

Test Program: retrieve a book data via Servlet
DB: Oracle 10g XE
JDK: jdk 6 u7
GlassFish: v3 Prelude

----------------------------
I could get data directly on SQL*Plus but the result returned by the following snippet was null.

public Book getBook(String bookId) throws BookNotFoundException {
        Book requestedBook = em.find(Book.class, bookId);

        if (requestedBook == null) {
                throw new BookNotFoundException("Couldn't find book: " + bookId);
        }

        return requestedBook;
-----------------------------

I have created a connection pool for Oracle 10g and ping was successful. I've also defined JNDI named jdbc/oracle. Below is my persistence.xml

-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name ="bookstore">
     
      <class>database.Book</class>
    
      <jta-data-source>jdbc/oracle</jta-data-source>
      
      <properties>
              <property name="eclipselink.target-database" value="Oracle"/>
              <property name="eclipselink.logging.level" value="INFO"/>
      </properties>
    </persistence-unit>
    
</persistence>
-----------------------------

Could someone tell me if I lost something there?
Thank you in advance.
[Message sent by forum member 'xmagic' (xmagic)]

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