To me, this just sounds like a design issue. The persistent class is User, right? I feel that that is the only class out of the 3 classes you mentioned that should be OJB controlled. Like I said earlier, have you considered aggregating the User class into the RegisterForm and LogonForm classes? If required, they could implement the same interface.
I don't really know the design of your system, or how you want it to work, but for me it would be natural for the User class to be seperate from the Form classes. Maybe in the constructor of the Form classes, you can pass a user as a parameter. User can be a property of the forms (ie. for works with user object).
What are your thoughts?
-Raymond Barlow
Alen Ribic wrote:
<snip>Ok I'm back again on this one. Lets try this again.
My objective:
Using Struts, I will need to create form bean for each Struts form.
So, for example, I will create RegisterForm and LogonForm classes. As you can se now, these two classes will have similarities in their getter/setter methods.
Hence I would like to Create a single User class that all these similar form beans can inherit.
public class RegisterForm extends User { // inherits necessary setters/getters from User class public ... validate(...) { // override superclasses version } }
public class LogonForm extends User { // inherits necessary setters/getters from User class public ... validate(...) { // override superclasses version } }
Now I want my form beans also to inherit ValidatorForm class.
So, I add extends on User class as follows: (don't really think this one is cool, but anyway, it works :) )
public class User extends ValidatorForm { // setter/getter properties }
As far as Struts side of things, this seems to be working fine so far.
Only reason I make use of form classes here that inherit my User class is because of validation requirements specific to each individual form. (needed in my Struts config) Now there is no way I'm rewriting my User specific setter/getter properties for each of my forms, e.g. RegisterForm, LogonForm. Both of these form beans will contain common setter/getter properties which need to map to the same table called User.
Again, if I need to specify for each form bean (RegisterForm, LogonForm) a separate class descriptor with it's own, SAME, fields, it would just suck a bit.
Hope this time I come roght. :)
I really appreciate your help. --Alen
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
