users@glassfish.java.net

RE: NullPointerException in ...

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Thu, 5 May 2011 09:54:41 -0400

Here is the reference (may be out-of-date as the grepcode doc was last updated 2007):
http://grepcode.com/file/maven.glassfish.org/content/repositories/glassfish-releases/javax.persistence/persistence-api/1.0-rev-1/javax/persistence/NamedQuery.java#NamedQuery[]

verify mainId is a non Null 50 character length value
verify qID is a varchar of length = 50 column defined in TEMPLATE_QUESTIONAIRE table
change "select tq from TemplateQuestionaire tq where tq.qID = :mainID"
to "select tq.qId from TEMPLATE_QUESTIONAIRE tq where tq.qID = :mainID"

Martin --
______________________________________________
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






> Subject: Re: NullPointerException in ...
> From: alexis.moussine-pouchkine_at_oracle.com
> Date: Thu, 5 May 2011 15:34:42 +0200
> To: users_at_glassfish.java.net
>
> I'm getting a different exception related to conflicting jpql queries.
> If I remove the NamedQueries, and use <jta-data-source>jdbc/__default</jta-data-source> (the default JavaDB datasource in GlassFish), all works well for me (same GlassFish 3.1 version).
> -Alexis
>
> On 5 mai 2011, at 15:06, forums_at_java.net wrote:
>
> > 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
> >
> >
>