|
Castor supports nested attributes, your mapping
could look like this:
<field name="login.userLogin"
type="string"> <sql name="name"
type="varchar"/> <xml
node="element" /> </field>
make sure you instantiate UserLogin in your User
class. so maybe you could have:
private UserLogin login = new
UserLogin();
----- Original Message -----
Sent: Tuesday, July 02, 2002 7:34
PM
Subject: [castor-dev] How to map
composition?
Hi , My problem is as follow:
I have 2
classes: User.java has the following attributes
: .... private String
name; private
UserLogin
login; ...
and
UserLogin.java: ... private
String
userLogin;
public
UserLogin(String
userLogin){ this.userLogin
=
userLogin; } public
String
getUserLogin(){ return
this.userLogin; } ...
The
database schema is something like
this: table:
user name:
varchar(50) login:
varchar(30) The
UserLogin class is not persistent( therefore, no table for it ) and the login
field in user table must have the result value of login.getUserLogin()
method.
The first field is very easy
to map , but how to map the object method login.getUserLogin() to login field
in database and vice-versa.
<field name="name"
type="string"> <sql name="name"
type="varchar"/> <xml
node="element"
/> </field> <field
name="login" ?????????? THIS IS MY PROBLEM :(
Please help
me ... :-(
Rodrigo Paes Ci�ncia da Computa��o - UFAL Messenger -
[EMAIL PROTECTED] ICQ - 85921785
|