Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » EvaluationException : Couldn't resolve type for 'Persistence::Entity'. Did you f
EvaluationException : Couldn't resolve type for 'Persistence::Entity'. Did you f [message #627853] Thu, 06 August 2009 12:29
Eclipse User
Originally posted by: karunyap.infotechsw.com

Hi,

I am a newbie to both UML2 and OAW 4.3.1 and need some help and guidance
on the following issue.

I have to use UML2/EMF API to programatically create a UML model and use
the Fornax hibernate cartridge to generate Entity classes.

I was sucessful in generating classes with the JavaBasic cartridge but
with the Hibernate cartridge I end up with the below issue.

EvaluationException : Couldn't resolve type for 'Persistence::Entity'. Did
you forget to configure the corresponding metamodel?
org::fornax::cartridges::uml2::hibernate::extensions::Naming .ext[1091,196]
on line 30 'String getFQNPackageName(Persistence::Entity this)'

I have performed the following steps.
1) Registered and loaded the default profiles that come bundled with UML2.
2) Loaded the hibernate [persistence.profile.uml] profile and applied it
onto a UML model object.
3) Programatically verified that the profile got loaded and the stereotype
[Persistence:Entity] was available.
4) Programatically created a java-class using UML2 API and applied the
Entity stereotype.
5) Invoked fornax hibernate template [feature_pojo] to run on the created
model.




	public static void generateEntities(){		
		//create a package add the package to the model
		Package pkg = umlFacade.createPackage(); 
		org.eclipse.uml2.uml.Model umlModel = umlFacade.createModel();	
		umlModel.getPackagedElements().add(pkg);
		pkg.setName("com.prefabware");
	
		//Use some thing else instead of EcoreUtil2
		URI persistenceURI = 
EcoreUtil2.getURI("profiles/Persistence.profile.uml");
		persistenceProfile = umlFacade.loadProfile(persistenceURI);
		
		try{			
			// apply the profile to the main package
			pkg.applyProfile(persistenceProfile);
			umlModel.applyProfile(persistenceProfile);
			
			//get stereotype of Entity 			
			Stereotype stereotype = persistenceProfile.getOwnedStereotype("Entity");
						
			//create a class
			Class cls1 = umlFacade.createClass();
			// add class to the pkg
			pkg.getPackagedElements().add(cls1);
			cls1.setName("StereoTypeTestwithPersistenceprofile");			

			// apply the stereotype to the baseclass
			cls1.applyStereotype(stereotype);			
			
			umlModel.getPackagedElements().add(cls1);			
		}
		catch (Exception e){
			e.printStackTrace();
		}

		
		//Some more code to use the XPand runner to load and run the hibernate 
template [feature_pojo.xpt]
		//this.getTemplate("org::fornax::cartridges::uml2::hibernate::templates::feature_pojo").evaluate("Root", 
model, null);
		//Now run this template.

		
		//Code fails at the evaluation time with the following stack trace

	/*
	EvaluationException : Couldn't resolve type for 'Persistence::Entity'. 
Did you forget to configure the corresponding metamodel?
	org::fornax::cartridges::uml2::hibernate::extensions::Naming.ext[1091,196] 
on line 30 'String getFQNPackageName(Persistence::Entity this)'

	at 
org.openarchitectureware.xtend.ast.AbstractExtension.init(AbstractExtension.java:226)
	at 
org.openarchitectureware.xtend.ast.ExtensionFile.getPublicExtensions(ExtensionFile.java:186)
	at 
org.openarchitectureware.xtend.ast.ExtensionFile.getPublicExtensions(ExtensionFile.java:165)
	at 
org.openarchitectureware.expression.ExecutionContextImpl.getAllExtensions(ExecutionContextImpl.java:302)
	at 
org.openarchitectureware.expression.ExecutionContextImpl.getExtensionForTypes(ExecutionContextImpl.java:315)
	at 
org.openarchitectureware.expression.ExecutionContextImpl.getExtension(ExecutionContextImpl.java:323)
	at 
org.openarchitectureware.expression.ast.OperationCall.evaluateInternal(OperationCall.java:75)
	at 
org.openarchitectureware.expression.ast.Expression.evaluate(Expression.java:51)
	at 
org.openarchitectureware.xpand2.ast.ExpressionStatement.evaluateInternal(ExpressionStatement.java:48)
	at 
org.openarchitectureware.xpand2.ast.Statement.evaluate(Statement.java:42)
	at 
org.openarchitectureware.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:178)
	at 
org.openarchitectureware.xpand2.XpandFacade.evaluate(XpandFacade.java:63)
	at 
com.prefabware.genlets.commons.XpandRunner.evaluate(XpandRunner.java:41)
	at 
com.prefabware.genlets.java.intern.FornaxXpandFacade.feature_pojo(FornaxXpandFacade.java:50)
	at 
com.prefabware.genlets.java.GenletJavaImpl.generateUsingFornaxHB(GenletJavaImpl.java:126)
	at 
com.prefabware.genlets.java.FornaxJavaBasicTest.testAppliedStereoType(FornaxJavaBasicTest.java:103)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
	*/



	}



Is there anything else that I have to do apart from loading and applying
the hibernate profile on the model object? Is any explicit registration
required?

Thanks for all your help.
Previous Topic:EvaluationException : Couldn't resolve type for 'Persistence::Entity'. Did you f
Next Topic:Creating EMap using MagicDraw
Goto Forum:
  


Current Time: Sat Sep 20 18:05:48 GMT 2014

Powered by FUDForum. Page generated in 0.01518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software