users@glassfish.java.net

Re: EJB is confused what it is seeing?

From: <glassfish_at_javadesktop.org>
Date: Wed, 22 Aug 2007 18:33:49 PDT

Thank you for offering several suggestions.

Here is how I have the Entity declared:

[code]
package ejb.bean.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@EntityListeners(jtdi.dim.ejb.bean.listener.JTDIAuditor.class)
@NamedQueries({
        @NamedQuery(name="findDataTypeByDescription",
                       query="SELECT dt FROM DataType dt " +
                                        "WHERE dt.description= ?1"),
        @NamedQuery(name="findDataTypeByCode",
                                query="SELECT dt FROM DateType dt " +
                                          "WHERE dt.code=?1")
})
@Table(name="DATA_TYPE")
public class DataType implements Serializable{
 
        private Long datatypeId;
        private Integer code;
        private String description;
[/code]

The my-ejb.jar file is constructed

[code]
 |_ejb\bean\entity All entity classes are here
 |_ejb\bean\manager Session Bean class is here
 |_meta-inf persistence.xml file is here.......
[/code]

My Session Bean is as follows:

[code]
@Stateless(mappedName="ejb/MyEntityManager")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Resource(name="jdbc/databasename", type=javax.sql.XADataSource.class )
public class MyEntityManagerRemote implements MyEntityManagerIFRemote {
        @PersistenceUnit(unitName="MyEJBPU")
        @PersistenceContext private EntityManager entityManager;
        
        

        public DimEntityManagerRemote(){
        }
        

        
        private DataType getDataType(String dataDesc){
                DataType dataType = null;
                try{
                        dataType = entityManager.find(DataType.class, 1L);
                        //Query query = entityManager.createNamedQuery(FIND_DATA_TYPE_BY_DESC);
                        //query.setParameter(1, dataDesc);
                        //dataType = (DataType)query.getSingleResult();
                }catch (NonUniqueResultException nure){
                        //more than one data type with same description
                        nure.printStackTrace();
                        handleException(nure);
                }catch(NoResultException nre){
                        //new data type
                        nre.printStackTrace();
                        handleException(nre);
                        dataType = new DataType();
                }
                return dataType;
        }//end method
[/code]

The beginning of the stacktrace looks like this:

[code]
javax.ejb.EJBException
        at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
[/code]

The root problem is still the same:

[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 [DateType] was not found.
        at oracle.toplink.essentials.exceptions.EJBQLException.missingDescriptorException(EJBQLException.java:158)
[/code]

I hope this helps explains it better.

Thank you for reading my post.

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

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