In my model, I am specifying the body of a finder method with an OCL _expression_ that basically appears as follows:

 

context PaymentTransaction::findProcessed(paymentId : String) : Collection(PaymentTransaction) body: allInstances() -> select ( txn | txn.id = paymentId and  txn.status <> com::sunrise::ecommerce::enum::TransactionStatusEnum::PENDING)

 

The last condition in the select function is what I am changing for each test case.  I do not mind using a string value for the enumerated value, but the more pressing issue is the inequality _expression_ not being translated correctly.  Let me know if this is a bug or if I have done something wrong in the _expression_.  The following are the results, each with a different problem:

 

Case 1:  Not equals for a string value.

 

  Resulting query:  from ...PaymentTransaction as txn where txn.id = :paymentId and txn.status < 'pend'

  OCL _expression_:   It had "txn.status <> 'pend'"

  Problem:            The ">" symbol was removed, or just incorrectly parsed (perhaps lexical analysis problem).  This always happens with any _expression_ containing "<>".

 

Case 2:  Not equals for an enumerated value.

 

  Resulting query:  None

  OCL _expression_:   It had "txn.status <> com::sunrise::ecommerce::enum::TransactionStatusEnum::PENDING"

  Problem:             Exception is thrown for this:

 

 

------- AndroMDA Exception Recording -------

Version ........: 3.0-RC1-20050221134303

Error ..........: Error performing ModelProcessor.process with model(s) --> 'jar:file:C:\Documents and Settings\David Allen\My Documents\ReservationBusiness\PMWorkspace\PaymentServices\mda/src/uml/PaymentSystemModel.xml.zip!/PaymentSystemModel.xml'

Build ..........: 2005-02-21 13:43:03

Build System ...: Linux-2.6.8-1.521

Build JDK ......: IBM Corporation-1.4.2

Build Builder ..: amartinwest

Run System .....: Windows XP5.1

Run JDK ........: Sun Microsystems Inc.1.4.2_06-b03

Main Exception .: Error performing Cartridge.processTemplateWithModelElements

Root Exception .: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getQuery' in  class org.andromda.cartridges.hibernate.metafacades.HibernateFinderMethodLogicImpl threw exception class org.andromda.core.translation.TranslatorException : Error performing ExpressionTranslator.translate with translationName 'query.Hibernate-QL', contextElement 'org.andromda.metafacades.uml14.OperationFacadeLogicImpl[findProcessed]' and _expression_ 'context PaymentTransaction::findProcessed(paymentId : String) : Collection(PaymentTransaction) body: allInstances() -> select ( txn | txn.id = paymentId and  txn.status <> com::sunrise::ecommerce::enum::TransactionStatusEnum::PENDING)'

org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getQuery' in  class org.andromda.cartridges.hibernate.metafacades.HibernateFinderMethodLogicImpl threw exception class org.andromda.core.translation.TranslatorException : Error performing ExpressionTranslator.translate with translationName 'query.Hibernate-QL', contextElement 'org.andromda.metafacades.uml14.OperationFacadeLogicImpl[findProcessed]' and _expression_ 'context PaymentTransaction::findProcessed(paymentId : String) : Collection(PaymentTransaction) body: allInstances() -> select ( txn | txn.id = paymentId and  txn.status <> com::sunrise::ecommerce::enum::TransactionStatusEnum::PENDING)'

 

David R. Allen

[EMAIL PROTECTED]

 

 

Reply via email to