users@glassfish.java.net

EJB is confused what it is seeing?

From: <glassfish_at_javadesktop.org>
Date: Wed, 22 Aug 2007 12:59:48 PDT

I have a simple Enterprise Application with a Web and EJB modules in it. In the Web module I have a servlet that calls an EJB in the EJB Module. While in the Web Module, I create the "detached" Entities for the EJB Module. The EJB Module is using JPA persistence. Next I call a method on the EJB and send the "detached" entities. The first thing the EJB Module does is it queries the database for any existing entities. If one record is not found, the EJB creates a new entity instance. After all the entities are checked, the EJB adds the new objects to the database. The application is running on GlassFish V1 UR1 P01 and I am using JDK 1.6.0.02 and MyEclipse 6.0GA.

What is happening is I am getting an error when I attempt to call the Servlet from the browser. This kicks off the process.

[code]
Caused by: Exception [TOPLINK-8006] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: A problem was encountered resolving the class name - The descriptor for [file_type] was not found.
[/code]

The distinction here is the file name is "FileType" while the table name is "file_type".

This is my declaration:

[code]
@Entity
@EntityListeners(ejb.bean.listener.MyAuditor.class)
@NamedQueries({
   @NamedQuery(name="findFileTypeByExtension",
             query="SELECT ft FROM file_type ft " +
                 "WHERE :extension=?1"),
   @NamedQuery(name="findFileTypeByDescription",
             query="SELECT ft FROM file_type ft " +
                 "WHERE :description=?1")
})
@Table(name="FILE_TYPE")
public class FileType implements Serializable{
......
......
}
[/code]

This is the Persistence.xml

[code]
<persistence-unit name="MYEJBPU" transaction-type="JTA">
                  <jta-data-source>jdbc/databsename</jta-data-source>
                <class>ejb.bean.entity.Collection</class>
                <class>ejb.bean.entity.CollectionType</class>
                <class>ejb.bean.entity.DataType</class>
                <class>ejb.bean.entity.DocMetaData</class>
                <class>ejb.bean.entity.Document</class>
                <class>ejb.bean.entity.FileType</class>
                <class>ejb.bean.entity.UrgencyIndicator</class>
                <class>ejb.bean.entity.WeaponsSystem</class>
                <properties>
                        <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/databasename?relaxAutoCommit='true'" />
                        <property name="toplink.jdbc.driver" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
                        <property name="toplink.jdbc.user" value="my_user"/>
                        <property name="toplink.jdbc.password" value="my_pwd" />
                        <property name="toplink.target-database" value="MySQL4" />
                        <property name="toplink.logging.level" value="FINEST" />
                        <!--
                                <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
                        -->
                </properties>
        </persistence-unit>
[/code]
Any assistance and insight would be greatly appreciated.

Thank you for taking the time to read my post.

Russ
[Message sent by forum member 'russ_ray' (russ_ray)]

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