PDA

View Full Version : Spring Data Graph Example (cineasts) @Related blues & how to run



anodynos
Jun 3rd, 2011, 07:22 AM
Hi to all

I was looking at the github cineasts example and it looks great, excellent example, thanks guys! :cool:

I have two issues and I would appreciate any help.

1) Unfortunately I am having some problems with it in Eclipse Helios. :(

Eclipse complains for all @RelatedTo & @RelatedToVia annotations, whenever elementClass is present :


Type mismatch : Cannot convert from Class<Role> to Class<? extends RelationshipBacked>

eg in



@NodeEntity
public class Movie {
.......
// error "Cannot convert from Class<Role> to Class<? extends RelationshipBacked>" here...
@RelatedTo(elementClass = Person.class, type = "ACTS_IN", direction = INCOMING)
Set<Person> actors;

@RelatedToVia(elementClass = Role.class, type = "ACTS_IN",
direction = INCOMING)
Iterable<Role> roles;
....
}


The strange thing is that the project builds the .class files and the tests run OK.

I am sensing something is cooked up in the latest commit or the pom.xml - could you please help somehow ?

2) Can someone highlight step-by-step how we can execute cineasts @localhost ? :confused:
There is not war/jar produced on build, is this OK or due to 1) above ?

Regards

MichaelHunger
Jun 4th, 2011, 03:59 AM
Please install the latest AJDT addon from: http://download.eclipse.org/tools/ajdt/36/dev/update

There was a visualization error in the latest release. The new AJ milestone will be released next week.

Please rebuild your project and then the visual errors should go away.

You run cineasts with:

mvn jetty:run
and then do (once)
http://localhost:8080/populate

It creates some movies and two users (one admin) see the DatabasePopulator class.

after that you can log in as the admin user (see username, password there) and use

http://localhost:8080/admin/import/1-100

to import the first 100 movies from themoviedb.org

Cheers

Michael

anodynos
Jun 4th, 2011, 02:16 PM
Michael thanks a lot!

Actually it was the 2.1.3 version of AJDT that was causing the problem on Eclipse 3.6 (maybe it works on 3.7)

Uninstalling version 2.1.3 given on http://download.eclipse.org/tools/ajdt/36/dev/update
and installing ver 2.1.2 from http://download.eclipse.org/tools/ajdt/36/update fixed the issue!

Thanks for the running tips also, all went smooth (perhaps too smooth : took 601 secs, which I hope was due to jason net grabbing, not neo4j)!

MichaelHunger
Jun 4th, 2011, 02:37 PM
Sure, just run the same import a second time then you see that's just the json grabbing :)

Cool that it worked out, have fun.

Michael

anodynos
Jun 4th, 2011, 03:26 PM
Well,

I.was.wrong();
problem.persists() ;

All efforts with ver 2.1.2 or 2.1.3 went bust...

Will have to learn to live with it until some solution with AJDT is found....

Thanks Michael!

anodynos
Jul 21st, 2011, 11:23 AM
Michael hi,

Have you got any idea about this issue ? (I also see it replicated here http://forum.springsource.org/showthread.php?110744-Neo4j-and-quot-Type-mismatch-quot-using-RelatedTo)

It still persists (at all examples Cineasts, helloworlds etc),
both in Eclipse 3.6 & 3.7 using the latest Spring plugins :

AspectJ Development Tools 2.2.0.e37x-20110711-1300
Spring IDE/SpringSource Tool Suite 2.7.1,
Maven Integration for Eclipse (Required) 0.12.1.20110112-1712

Apart from,

Type mismatch : Cannot convert from Class<Role> to Class<? extends RelationshipBacked>

in all @RelatedToVia & @RelatedTo annotations,

I also get


The method relateTo(World, String) is undefined for the type World

on all relateTo calls like



public void addRocketRouteTo( World otherWorld )
{
relateTo( otherWorld, RelationshipTypes.REACHABLE_BY_ROCKET );
}



and


- Bound mismatch: The type World is not a valid substitute for the bounded parameter <T
extends GraphBacked<?>> of the type NamedIndexRepository<T>
- Bound mismatch: The type World is not a valid substitute for the bounded parameter <T
extends GraphBacked<?>> of the type GraphRepository<T>


on all repository definitions like


public interface WorldRepository extends MyWorldRepository, GraphRepository<World>, NamedIndexRepository<World> {}

anodynos
Jul 21st, 2011, 04:23 PM
Ok, problem solved.

The answer is from https://jira.springsource.org/browse/DATAGRAPH-39



Thomas Risberg added a comment - 21/Mar/11 9:00 AM

Try editing the build path to include **/*.aj for the spring-data-neo4j project

You can do this by selecting "Build Path -> Configure Build Path ..." from the Package Explorer

Then for the spring-data-neo4j/src/main/java add "**/*.aj" to the Included path

This fixed the problems for me. Looks like the m2eclipse plugin is not adding these sources automatically even though it's setting things up for AspectJ in other ways.


A silly yet annoying problem...!

MichaelHunger
Jul 23rd, 2011, 06:40 AM
Agreed,

we'll look into easing this pain.

Michael