Customizing roo-generated identifiers

12 views
Skip to first unread message

Bala

unread,
Jul 29, 2011, 12:45:54 AM7/29/11
to Spring Roo Cookbook
Recently i purchased you "Spring roo cookbook". This is really good
book for starters. I was able to create sample application using roo
with jsf/primefaces.

I have few questions regarding roo generated identifiers:

1) I have reverse engineered the tables from mysql. I need to change
the table generater as you mentioned in the book. I changed
User_Roo_Entity.aj. When i opened roo shell, the changes made by me is
not there.

your book says "You can override the roo-generated identifier
definition by redifining the identifier (with the same name) in the
entity's Java source file.".

I did't really understand what you say. Can you please explain with 1
entity.

2) Also i need to add some transient fields to existing entity
generated using roo. In which file. i need to modify.
3) Also i need to add custom finder class ( directly in the program,
not through add using roo shell). Please explain.

I am interested to attend a training for Roo. If you are able to teach
me through online, i am willing to pay for the service. I am currently
not in India.

Thanking you,
Bala

Ashish Sarin

unread,
Jul 30, 2011, 10:18:14 AM7/30/11
to spring-ro...@googlegroups.com
Hi Bala,

I'm glad that you are finding the book useful.

Here are the answers to your questions:
1. You should never make changes to AspectJ ITD files because they'll be overwritten by Spring Roo. You should define the identifier in the .java file (which is User.java in your case). Once you define entity identifier in User.java file, Roo will automatically remove the identifier definition from User_Roo_Entity.aj file. I've further clarified this concept in Chapter 3.
2. You should define your transient fields in the Java source file and not in the AspectJ ITD file.
3. You should add custom finder methods in the Java source file and not in the AspectJ ITD file.

I'll not be able to conduct training online but you can send your questions to me at the following e-mail id: ashes dot sarin at gmail dot com, and I'll respond to your questions as early as possible.

regards
ashish 
Reply all
Reply to author
Forward
0 new messages