I am attaching a patch. You can't have "from" in HQL delete statements either.

Tammy

On 8/19/2011 1:23 PM, Wyclif Luyima wrote:
Actually the where clause should have concept and not conceptId, i have created this ticket https://tickets.openmrs.org/browse/TRUNK-2584

Wyclif

On Fri, Aug 19, 2011 at 12:29 PM, Ben Wolfe <[email protected] <mailto:[email protected]>> wrote:

    Interesting. So, apparently users don't delete concepts, like,
    ever. :-)

    On Aug 19, 2011 6:45 PM, "Wyclif Luyima" <[email protected]
    <mailto:[email protected]>> wrote:
    > Ah! That is the bug,seems like it is in most of the OpenMRS
    versions, so
    > purgeConcept and deleteConceptWord are both faulty.
    >
    > Wyclif
    >
    > On Fri, Aug 19, 2011 at 10:42 AM, Ben Wolfe <[email protected]
    <mailto:[email protected]>> wrote:
    >
    >> Is that supposed to be ConceptId instead of concept_id ?
    >>
    >> Which openmrs version are you using?
    >>
    >> Ben
    >>
    >>
    >> On Fri, Aug 19, 2011 at 5:20 PM, Tammy Dugan <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >>> I also can't get update concept words to work either.
    >>>
    >>> Tammy
    >>>
    >>>
    >>> On 8/19/2011 9:36 AM, Tammy Dugan wrote:
    >>>
    >>> When I try to create a new concept through the webapp, I get
    the following
    >>> error:
    >>>
    >>> *java.lang.NullPointerException*
    >>>
    >>>
    >>>
    
org.hibernate.impl.SessionFactoryImpl.getImplementors(SessionFactoryImpl.java:709)
    >>>
    org.hibernate.hql.QuerySplitter.concreteQueries(QuerySplitter.java:100)
    >>> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:68)
    >>> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
    >>>
    >>>
    
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
    >>>
    >>>
    
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
    >>>
    >>>
    
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
    >>> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
    >>> *
    >>>
    
org.openmrs.api.db.hibernate.HibernateConceptDAO.deleteConceptWord(HibernateConceptDAO.java:817)
    >>> *
    >>> *
    >>>
    
org.openmrs.api.db.hibernate.HibernateConceptDAO.updateConceptWord(HibernateConceptDAO.java:777)
    >>> *
    >>> *
    >>>
    
org.openmrs.api.impl.ConceptServiceImpl.updateConceptWord(ConceptServiceImpl.java:1176)
    >>> *
    >>>
    >>>
    >>> It happens when I try to run this part of line 817:
    >>>
    >>> sessionFactory.getCurrentSession().createQuery("delete from
    ConceptWord
    >>> where concept_id = :c")
    >>>
    >>> This statement works just fine:
    >>>
    >>> sessionFactory.getCurrentSession()
    >>>
    >>>
    >>> Tammy Dugan
    >>>
    >>> --
    >>> Tammy Dugan
    >>> CHIRDL Technical Lead
    >>> Children's Health Services Research
    >>> IU School of Medicine
    >>>
    >>> ------------------------------
    >>> Click here to
    unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l
    <http://[email protected]?body=SIGNOFF%20openmrs-devel-l>>from
    OpenMRS Developers' mailing list

    >>>
    >>>
    >>> --
    >>> Tammy Dugan
    >>> CHIRDL Technical Lead
    >>> Children's Health Services Research
    >>> IU School of Medicine
    >>>
    >>> ------------------------------
    >>> Click here to
    unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l
    <http://[email protected]?body=SIGNOFF%20openmrs-devel-l>>from
    OpenMRS Developers' mailing list
    >>>
    >>
    >> ------------------------------
    >> Click here to
    unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l
    <http://[email protected]?body=SIGNOFF%20openmrs-devel-l>>from
    OpenMRS Developers' mailing list
    >>
    >
    > _________________________________________
    >
    > To unsubscribe from OpenMRS Developers' mailing list, send an
    e-mail to [email protected]
    <mailto:[email protected]> with "SIGNOFF
    openmrs-devel-l" in the body (not the subject) of your e-mail.
    >
    > [mailto:[email protected]
    <mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l]
    ------------------------------------------------------------------------
    Click here to unsubscribe
    <mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l> from
    OpenMRS Developers' mailing list


------------------------------------------------------------------------
Click here to unsubscribe <mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list

--
Tammy Dugan
CHIRDL Technical Lead
Children's Health Services Research
IU School of Medicine


_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]
Index: HibernateConceptDAO.java
===================================================================
--- HibernateConceptDAO.java    (revision 20586)
+++ HibernateConceptDAO.java    (working copy)
@@ -322,7 +322,7 @@
         */
        public void purgeConcept(Concept concept) throws DAOException {
                // must delete all the stored concept words first
-               sessionFactory.getCurrentSession().createQuery("delete from 
ConceptWord where concept_id = :c").setInteger("c",
+               sessionFactory.getCurrentSession().createQuery("delete 
ConceptWord where concept = :c").setInteger("c",
                    concept.getConceptId()).executeUpdate();
                
                // now we can safely delete the concept
@@ -814,7 +814,7 @@
                                
                                log.debug(authUserId + "|ConceptWord|" + words);
                        }
-                       sessionFactory.getCurrentSession().createQuery("delete 
from ConceptWord where concept_id = :c").setInteger("c",
+                       sessionFactory.getCurrentSession().createQuery("delete 
ConceptWord where concept = :c").setInteger("c",
                            concept.getConceptId()).executeUpdate();
                }
        }
@@ -904,7 +904,7 @@
         * @see org.openmrs.api.db.ConceptDAO#updateConceptSetDerived()
         */
        public void updateConceptSetDerived() throws DAOException {
-               sessionFactory.getCurrentSession().createQuery("delete from 
ConceptSetDerived").executeUpdate();
+               sessionFactory.getCurrentSession().createQuery("delete 
ConceptSetDerived").executeUpdate();
                try {
                        // remake the derived table by copying over the basic 
concept_set table
                        sessionFactory

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to