Hi Alen,

I'm fairly new to OJB, but I'm pretty sure that you would have to define a class-descriptor for the RegisterForm class. Just try this for now to see if it fixes your problem: copy the entire User class descriptor into a new RegisterForm class descriptor and just change the relevant bits (ie. class="za.co.alen.struts.RegisterForm").

It is a pain, but I think OJB needs to know how to map each extent class individually. There has been some postings about using "this" to extend mappings, but I've not been able to get this to work successfully.

Just thinking about your problem a bit futher, how is OJB to differentiate between a User class and a RegisterForm class when searching for a class? ie. If RegisterForm is the same table and persistent fields as User, then how can OJB tell if it should be giving you a User class or a RegisterForm class? Maybe an alternative for you is to have RegisterForm contain an aggregated User class? This way you could search for User, then create your RegisterForm class passing the relevant User class. Just some ideas....

Regards,
Raymond Barlow

Alen Ribic wrote:

Thanks Raymond for your reply.

This is the thing. I am very lost.
The User class descriptor in repository contains all my filed mappings to my
User table in db.
Now za.co.alen.struts.RegisterForm class mapping is a very good question.
What would the za.co.alen.struts.RegisterForm class mapping contain? I don't
need any RegisterForm class specific fields at all.
I just need to indicate to OJB that it needs to something like cast
RegisterForm instance to User and hence would need to map that to User class
/ table mapping. (Remember that the instance I get is of
za.co.alen.struts.RegisterForm)
RegisterForm class does not have any real meaning for persistence besides
the inherited fields from User bean.
It basically just contains overridden validate(...) method used for
server-side validation in my struts components.

I hope this is making sense. :-)

--Alen



----- Original Message -----
From: "Raymond Barlow" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 10:45 AM
Subject: Re: Extent. How to?




Hi Alen

I hate to ask the obvious, but you never know :)
Have you created a mapping for za.co.alen.struts.RegisterForm in your
repository_user.xml file??

Regards,
Raymond Barlow

Alen Ribic wrote:



Hi again

I have sent an email already and got a good reply, but now I have an


issue


with mapping side.

I have got classes as follows:

// JavaBean
public class User extends ValidatorForm {}

// Struts form bean
public class RegisterForm extends User {}

Now I just need OJB to recognize RegisteForm class as a User.

usr = request.getAttribute("registerForm"); // returns RegisteForm


instance


broker.store(usr);

So now, OJB on store(...) should look at mapping for User class to User
table.

<class-descriptor
    class="za.co.alen.jfaq.User"
    table="User"
 >
    <extent-class class-ref="za.co.alen.struts.RegisterForm" />
    <!-- field mappings -->
    ...
 </class-descriptor>

I presume that now I need a <class-descriptor/> for the RegisterForm


class.


Is this correct?
I looked at the Article example but I just can't get my one to work.

My app still says that OJB cannot recognize RegisterForm class in
repository.

What am I doing wrong and how can I go about doing this correctly.

Thanks

--Alen



---------------------------------------------------------------------
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]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- Regards, Raymond Barlow



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to