You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Sebastian Galonska <sg...@gmx.net> on 2002/05/09 12:11:46 UTC
Torque newbie questions
Hello group,
as a newbie with Torque I would like to know how it is possible to use n:m
relations.
Let´s quickly come to terms. I´ve got these classes for example:
class businessObject {
public int id; // primary key
// ... more attributes
}
class Project extends businessObject{
public HashSet myPersons;
// ... more attributes
}
class Person extends businessObject {
String name;
String surname;
// ... more attributes
}
It is recommended that several persons can belong to several projects. So I
created the following tables:
================
table Project:
---------------------
id: int
...
================
Table Person:
---------------------
id: int
name: text
surname: text
...
================
Table Project_Person:
---------------------
oid_project: int
oid_person: int
How to access the Persons that are involved in a project?
Another question is about how to implement transactions with Torque. How
can I initiate and how can I finalize a transaction?
Is Torque capable to meet my needs? (Hope yes ;-)).
Thank you vor your help
best regards
Sebastian
--------------------------------
Sebastian Galonska
Ritterstrasse 96
10969 Berlin
GERMANY
phone: +49 30 61107231
mobile: +49 177 8806060
fax: +49 30 61107232
ICQ#: 11524202
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Torque newbie questions
Posted by John McNally <jm...@collab.net>.
Based on your schema below, torque will generate methods like:
Project.getProjectUsers(Criteria)
and
User.getProjectUsers(Criteria)
you can use these methods to build better named methods, similar to
this:
Project.java
public List getUsers(Criteria crit)
{
List pus = getProjectUsers(crit);
List users = new ArrayList(pus.size());
Iterator i = pus.iterator();
while (i.hasNext())
{
users.add( ((ProjectUser)i.next()).getUser() );
}
return users;
}
john mcnally
On Thu, 2002-05-09 at 03:11, Sebastian Galonska wrote:
> Hello group,
>
> as a newbie with Torque I would like to know how it is possible to use n:m
> relations.
> Let´s quickly come to terms. I´ve got these classes for example:
>
> class businessObject {
> public int id; // primary key
> // ... more attributes
> }
>
> class Project extends businessObject{
> public HashSet myPersons;
> // ... more attributes
> }
>
> class Person extends businessObject {
> String name;
> String surname;
> // ... more attributes
> }
>
> It is recommended that several persons can belong to several projects. So I
> created the following tables:
>
> ================
> table Project:
> ---------------------
> id: int
> ...
> ================
> Table Person:
> ---------------------
> id: int
> name: text
> surname: text
> ...
> ================
> Table Project_Person:
> ---------------------
> oid_project: int
> oid_person: int
>
> How to access the Persons that are involved in a project?
> Another question is about how to implement transactions with Torque. How
> can I initiate and how can I finalize a transaction?
> Is Torque capable to meet my needs? (Hope yes ;-)).
>
> Thank you vor your help
>
> best regards
> Sebastian
> --------------------------------
> Sebastian Galonska
> Ritterstrasse 96
> 10969 Berlin
> GERMANY
>
> phone: +49 30 61107231
> mobile: +49 177 8806060
> fax: +49 30 61107232
>
> ICQ#: 11524202
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Torque newbie questions
Posted by Eric Dobbs <er...@dobbse.net>.
Two things first. Let's move this conversation
to the turbine-torque-user list. And please
send the <project>-schema.xml file you are using
to generate the tables and objects described in
your email.
-Eric
On Thursday, May 9, 2002, at 04:11 AM, Sebastian Galonska wrote:
> It is recommended that several persons can belong to several projects.
> So I created the following tables:
>
> ================
> table Project:
> ---------------------
> id: int
> ...
> ================
> Table Person:
> ---------------------
> id: int
> name: text
> surname: text
> ...
> ================
> Table Project_Person:
> ---------------------
> oid_project: int
> oid_person: int
>
> How to access the Persons that are involved in a project?
> Another question is about how to implement transactions with Torque.
> How can I initiate and how can I finalize a transaction?
> Is Torque capable to meet my needs? (Hope yes ;-)).
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>