users@glassfish.java.net

Re: NullPointerException in ...

From: <forums_at_java.net>
Date: Thu, 5 May 2011 08:06:57 -0500 (CDT)

My persistence.xml:

<persistence-unit name="qDBJPA"
    transaction-type="JTA">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  <jta-data-source>qDB</jta-data-source>
  <non-jta-data-source>qDBNonJta</non-jta-data-source>
  <class>de.mycompany.TemplateQuestionaire</class>
</persistence-unit>

My classes:

@Entity
@Table(name = "TEMPLATE_QUESTIONAIRE")
@NamedQueries( { @NamedQuery(name = "findAllQuestionaires", query = "select
tq from TemplateQuestionaire tq"),
        @NamedQuery(name = "findQuestionairesByID", query = "select tq
from TemplateQuestionaire tq where tq.qID = :mainID") })
public class TemplateQuestionaire  implements Serializable {
  @Id
  @Column(name = "qID", length = 50)
  @NotNull
  private String templateQuestionaireId;
 ...
}
@Stateless
@LocalBean
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class TemplateService implements TemplateServiceLocal,
TemplateServiceRemote {
  @PersistenceContext(unitName = "qDBJPA")
  private EntityManager em;
  public TemplateQuestionaire loadTemplateQuestionaire(String
templateQuestionaireId) {
    return em.find(TemplateQuestionaire.class, templateQuestionaireId);
  }
}

 


--
[Message sent by forum member 'MohamzJava']
View Post: http://forums.java.net/node/798500