I just picked up Roo 1.1.1, and decided to crank up a new project to play around with it. However, I've run into a weird problem that I'm not entirely sure is the fault of my own ignorance! Any help would be greatly appreciated.
Here is a Roo script that I've used to reproduce the problem (attached as 'roo.script.txt'):
Nothing too exciting here: create a Google AppEngine project with two entities, and create a one-to-many from the 'Foo' type to the 'Bar' type. The script runs without an error and exits cleanly.Code:// Spring Roo 1.1.1.RELEASE [rev 156ccd6] log opened at 2011-01-12 09:52:47 download status download accept terms of use project --topLevelPackage example persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE entity --class ~.domain.Bar entity --class ~.domain.Foo field set --fieldName bars --type ~.domain.Bar exit // Spring Roo 1.1.1.RELEASE [rev 156ccd6] log closed at 2011-01-12 09:57:44
However, look at the generated Foo_Roo_JavaBean.aj file; specifically the setBars(Set<Bar> bars) method. Mine looks like this:
What is that second 'for' loop doing? Where did the Employee type come from? Shouldn't that be "for (Bar bar : bars) {" ... ?Code:public void Foo.setBars(Set<Bar> bars) { Set<example.domain.Bar> localBars = new HashSet<example.domain.Bar>(); List<Long> longIds = new ArrayList<Long>(); for (Key key : barsKeys) { if (!longIds.contains(key.getId())) { longIds.add(key.getId()); } } for (Employee entity : bars) { if (!longIds.contains(entity.getId())) { longIds.add(entity.getId()); barsKeys.add(KeyFactory.createKey(Bar.class.getName(), entity.getId())); } localBars.add(entity); } this.bars = localBars; }
Any help would be greatly appreciated!
Thanks,
Peter


Reply With Quote

robenplan:war:0.1.0.BUILD-SNAPSHOT
