On 9/7/07, Rob Hills <[EMAIL PROTECTED]> wrote: > > Hi Michael, > > On 7 Sep 2007 at 14:50, Michael Horwitz wrote: > > > For AppFuse 2.0.X the easiest approach is simply to include the code for > the > > User class and modify as required: > > http://www.appfuse.org/display/APF/AppFuse+Core+Classes > > Thanks for that suggestion and the link. I'd obviously not looked through > the > documentation carefully enough. I agree that would probably be the > easiest > way up front, but I'm concerned it will add to the workload later when/if > I > need to upgrade to a newer AppFuse version.
Not necessarily. It is fairly simple to do a diff between your code and the new AppFuse code and include any new changes, particularly if the changes you are making are small. I think Matt recently described an upgrade effort on an existing project as roughly half a day. > On 9/7/07, Rob Hills <[EMAIL PROTECTED]> wrote: > > > I need to add a single attribute to the user class and was wondering > what > > > was the "recommended" way to go about this. > > > > > > I had thought to extend org.appfuse.model.User adding my own > attributes, > > > getters and setters, but had concerns about a couple of things: > > > > > > 1. What hibernate annotations do I use. For example, if I add > > > Entity(name="app_user"), does Hibernate happily accept that and create > > > one table based on the last class in the inheritance chain? > > I've since read some of the Hibernate documentation and it appears that to > do this, the org.appfuse.model.User class would have to have an > @MappedSuperclass which it doesn't of course. Yup. This approach was discussed a while back and eventually dropped as getting a little complicated. Also does not help if you need to remove/change an existing attribute... > > 2. Do I have to do anything to ensure Acegi security still > works? I > > > haven't been able to find yet where Acegi security is plugged into the > > > app_user table (or the org.appfuse.model.User or any related class) > but > > > I'm > > > guessing it would still be able to happily work via that class anyway, > is > > > that > > > correct? The AppFuse User class implements the org.acegisecurity.userdetails.UserDetails interface which constitutes the core of the integration into ACEGI. > > > > > The other alternative I thought of would be to create my own > independent > > > user class with its own DB table and create a one-to-one relationship > > > between the two, but as I only need to add a single attribute to the > > > class, that > > > would seem to be a bit of overkill. I suspect that would also > complicate > > > user > > > management forms. > > > > > > I'd value people's thoughts on this. I'm also happy to summarise the > > > results > > > of any discussion as an FAQ if people think that's worthwhile. > > I'm starting to think that the **most maintainable** (as opposed to the > easiest) way to do this will be to use my second approach, ie separate > entity > with a one-to-one relationship. IMHO stick with the easiest. Normally turns out to be the most maintainable too..... Mike. Cheers, > Rob Hills > Waikiki, Western Australia > Mobile +61 (412) 904-357 > Fax: +61 (8) 9529-2137 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
