You may try Composition rather than Inheritance. You can make a User a property of your other People objects. So you have a Person root class that you can extend (if you have a tree-like domain need) and then you encapsulate the User property as that Person's userAccount property.
I think I have done something like that in the past where there were People in the application and some were Users and others were not. viggo wrote: > > I've also been thinking of extending the original User class by adding > more properties to it. The way I did it was to extract the core model > classes from appfuse, add @Inheritance(strategy=InheritanceType.JOINED) to > the User.java, and then create a new class which extends User, and add > @Entity to it. > I'm not sure what kind of project you have, but I'm using a modular-spring > project. In order to use your own model classes you have to exclude the > core appfuse model classes by added this to the pom.xml of the web module: > > <dependency> > <groupId>org.appfuse</groupId> > <artifactId>appfuse-${web.framework}</artifactId> > <version>${appfuse.version}</version> > <type>warpath</type> > <!-- Excluded the appfuse-data-common due to > personal changes in the > core model --> > <exclusions> > <exclusion> > <groupId>org.appfuse</groupId> > > > <artifactId>appfuse-data-common</artifactId> > </exclusion> > </exclusions> > </dependency> > > Anyone who disagree to this solution??? > > > > Bryan Noll wrote: >> >> I assume you're using 2.0 because of the annotations. Did you change >> the <class> mapping in the hibernate.cfg.xml file so it is looking for >> InukUser instead of org.appfuse.model.User? >> >> Matt Raible wrote: >>> Which version of AppFuse are you using? >>> >>> Matt >>> >>> On 2/21/07, sionsmith <[EMAIL PROTECTED]> wrote: >>>> >>>> Hi all, >>>> >>>> I've been playing around with this for a few hours now and i cant >>>> seem to >>>> get it working, the users in my system have a number of added entities >>>> compared with that of the stand appfuse one. I thought i could just >>>> extend >>>> the class and place the new attributes in the new class. >>>> >>>> ================ >>>> Example InukUser.java >>>> public class InukUser extends User { >>>> protected String region; >>>> protected boolean student; >>>> protected String nusNumber; >>>> >>>> @Column(name="region") >>>> public String getRegion() { >>>> return region; >>>> } >>>> ...... >>>> >>>> ================ >>>> When i used the userManager.getUserByUserName("tomcat"); i get a >>>> classCastException using my own InukUser - what i'm i doing wrong? >>>> >>>> I have also tried to implement my own usermanager which returns a >>>> InukUser >>>> but this didnt seem the right way to do it. >>>> >>>> While creating my own implementation it occurred to me that i the >>>> database >>>> had the existing appfuse User structure, i changing the >>>> hibernate.cfg.xml so >>>> that my user was included in the mapping, but when i created the >>>> tables this >>>> table was not created. I placed the: >>>> >>>> @Entity >>>> @Table(name="inuk_user") >>>> >>>> at the top of the InukUser class but not sure how you map the >>>> "extends" in >>>> the new hibernate 3 annotations without adding a >>>> @Inheritance(strategy=JOINED) to the master class. >>>> >>>> Any help with how to do this or how to map this out using the Appfuse >>>> framework would be very great and a great saving of my time :) >>>> >>>> Many Thanks - Keep up the hard work Matt >>>> >>>> Sion >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Extending-AppFuse-User-tf3268186s2369.html#a9085424 >>>> >>>> Sent from the AppFuse - User mailing list archive at Nabble.com. >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- View this message in context: http://www.nabble.com/Extending-AppFuse-User-tf3268186s2369.html#a9093175 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]