This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

using interfaces in roo

Jun 2nd, 2010, 06:00 AM

hello

i have an interface "Person". Classes student and teacher implement Person..
In roo shell,
when i have a member in class College-- private Person p;
it says Person has be have @Entity (but it is an interface) .. im going to inject a student to p in college from applicationContext
1)it doesnt create a controller for College
2) it does not seem to update *.aj files for student and teacher when i add "implements Person" ..
3)how to represent value types (say using @Embedded)

Comment

I'm assuming that College is an entity. If you want a field injected by Spring, simply add the field in Java source and annotate it with @Autowired and @Transient. Roo entity relationship management is intended to be managed by JPA, not the Spring container.

However, I assume that Student, Teacher and College and Person are entities. So I don't understand why you would want to inject an entity reference using Spring.

Re (2), Roo will not automaticaly update .aj files when you make an entity implement an interface.

Comment

Person is just an interface (its full of methods) so i dint know how to js use methods without members in Person.java in roo

in my application, i dunno whether the person in class college is going to be a student or teacher.. so the container *.xml will contain whatever i want to inject (either student or teacher).. im going to use gwt soon for the UI.