My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 2: Misterious null pointer exception when creating 'via' relationship.
  Back to list
Status:  New
Owner:  ----


 
Reported by sash...@gmail.com, Nov 1, 2011
What steps will reproduce the problem?

This is following example from 'Getting Started With Roo' book, located here http://spring-roo-repository.springsource.org/Getting_Started_with_Roo.pdf

On page 21, it suggests running this command,

roo> graph relationship --from ~.model.CartOrder --to ~.model.Product --via
~.model.LineItem --fieldName items --cardinality ONE_TO_MANY

If you run it 'as is' you will get this error:

SRC MAIN JAVA\com\crmco\crm\model\LineItem.java already exists

If you delete the above java file and try to rerun the previous command, you get a NullPointerException

Created SRC MAIN JAVA\com\crmco\crm\model\LineItem.java
Updated SRC MAIN JAVA\com\crmco\crm\model\CartOrder.java
Undo manage SRC MAIN JAVA\com\crmco\crm\model\CartOrder.java
Undo create SRC MAIN JAVA\com\crmco\crm\model\LineItem.java
NullPointerException at org.springframework.roo.addon.graph.GraphMetadata$1.addRelationshipMethods(GraphMetadata.java:173)

Looks like there is a problem with 'annotation' passed into this method.

What version of the product are you using? On what operating system?

I think I am using version 1.1.0.RELEASE built on Fri Sep 09 02:41:01 CEST 2011
OS is Windows XP

This problem is also reported in this thread: http://support.oreilly.com/oreilly/topics/source_code_for_roo_project
Nov 1, 2011
#1 sash...@gmail.com
After further investigation, looks like 'RelatedToVia' annotation REQUIRES field named 'type', although documentation says that it's optional.

The failing line 173 has this content:

final String relationshipTypeName = (String) annotation.getAttribute(symbol("type")).getValue();

Looks like somebody needs to insert 'type' attribute to RelatedToVia annotation



Powered by Google Project Hosting